Util Module


The Util module contains number of general utilities to support this.
  1. Functional error system.
  2. Parser for tokens and AST.
  3. Show and persistence frame work
  4. Immutable Array based collection system inlcuding flat Array[Int] and Array[double] based compound value collections of same length elements.
  5. Basic geometry.
  6. A number of implementation Value classes of the Int and Double product classes defined in ostrat.
  7. 2d graphical objects for generalised use. They are of particular use for the generic canvas based classes defined in pCanv but can be used in any display framework and for printing.
  8. ostrat.geom A pure or near pure functional package.


The Tokeniser will create the following tokens

KeyTokens, Identifiers, and literals are all expressions. Operators, seperators and comments are not. Identifers includes lexemes such as if, IF true and TRUE. There are no alphabetic keywords in RSON syntax. Consumers of RSON syntax can of course treat what ever identifers they want as keywords appropriate to their use case. Identifers are categorised into 3 types.

Numerical literals come in 4 types.

LetterChar = unicode_letter | '_'
NonZeroDigit = '1' ... '9'
DigitChar = '0' | NonZeroDigit
HexaLowerChar = 'a' ... 'f'
HexaUpperChar = 'A' ... 'F'
HexaLetterChar = HexaLowerChar | 'a' ... 'f'
HexaChar = DigitChar | HexLetterChar
LetterOrDigitChar = LetterChar | DigitChar
LetterOrUnderscoreChar = LetterChar | '_'
UnderscoreThenLetterOrDigit = '_', LetterOrDigitChar
Dot3Token = "..."
Dot2Token = ".."
DotToken = '.'

IdentifierToken = letter | UnderscoreThenLetterOrDigit, { LetterOrDigitChar | UnderscoreThenLetterOrDigit }
DeciLitToken = '0' | (NonZeroDigit { DigitChar })

Abstract Syntax Tree

So after the source has been tokenised it is parsed into an Abstract Syntax tree. the basic idea is that an RSON file can be three things.

  1. An unStatemented file. It just contains an expression, without a semi colon at the end for example could just an Int or String.
  2. A Statemented file
  3. The empty file. It may contain comments but no expressions. The empty statement is a thing in itself but also a special case of a claused statement with with zero Clauses.
  1. An unclaused Statement. It just contains an expression, without a comma at the end for example could just an Int or String.
  2. A Claused Statement
  3. The empty Statement It may contain comments but no expressions. The empty file is a thing in itslef but also a special case of a Statemented file with zero statements.
So there is currently some confusion as to where it is parsed into a series of statements or into an expression. Currently Statements and Clauses contain an expression but are not themsleves an expression. This is causing a block to me coding at the moment.

AST Precedence From lowest to highest after brace block parsing.

Hexadecimal and Base32

Hexadecimal is written with Uppercase letters. Base32 is written with the digits followed by the upper case letters A to W, with the letter 'O' unused.

A 10, B 11, C 12, D 13, E 14, F 15, G 16, H 17, I 18, J 19, K 20, L 21, M 22, N 23, P 24, Q 25, R 26, S 27, T 28, U 29 V 30, W 31


A Lower case letter will be use after numerals in names.