The file format is defined in a formal way for sintax, in a informal for the semantic.
Definition of the metalanguage:
Definition
A = B means A is defined like B
Sequence
A + B means A is tied with B
Selection
A | B means A or B
Repetition
{A } means that it is possible repeat A a inprecisate number or time ( also zero ).
Optional
[ A ] means A or nothing
Non rapprentable simble
`description' in this way you can indicate a simbol the you can't print
Also:
An identificator in bold means a terminal simbol, a normal identificator means a non terminal simbol.
Numeric definition
plus = `the simbol +'
dot = `the simbol .'
digit = [ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ]
number_integer = [ - | plus | ] + digit + { digit }
number_float = number_integer + [ . + { digit } ]
number_real = number_float + [ E + number_integer ]
number_integer
is an integer number (es. 18554).
number_float
is a number with comma (es. 34.87653).
number_real
is a number in scientific format (es. 13.47E-2 ).
definition of identificator
alfama = [ A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | X | Y | Z ]
alfami = [ a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | x | y | z ]
alfa = [ alfama | alfami ]
ident_first = [ alfa | _ ]
ident_other = [ alfa | digit | _ ]
ident = ident_first + [ { ident_other } ]
ident_first
is the first character of an identifer.
ident_other
the type of all characters of an identifier but the first.
ident
declaretion of an identifier.
definition of a separator
( between identifiers or numbers or other )
ret_carriage = 'carriage return ( ASCII = 13 ) '
space = ' '
tab = ' tabulation character ( ASCII = 6) '
sep = { [ space | ret_carriage | tab ] }
The separator is used to separe two identifiers.
There is no difference between space, carriage return and tabulation.
Now we will use a new meta-operator dot ( . ), with the meaning of " + sep +".
For example: a . b is the same of "a b" or of "a b"
Other common definition
vector = ( . number_real . { , . number_real } . )
matrix = [ . number_real . { [ , | ; ] . number_real } . ]
point = ( . number_real . , . number_real . , . number_real . )
color = point
matrix
this definition is meaningfull if the groups which are separated from ; have the same number of elements separated from , .
For example [ 2 , 3 ; 4 1.2 ] is correct, [3, 1; 7 ] is not correct.
Section
For the text type definition the common way to represent the structured data is to create a section which contains the data with similar definition.
The definition prototype is :
section = { . sectionname . defsection . }
sectionname = ident
section
definition of whole section.
sectionname
definition of the type of the section.
defsection
declaration of the data in the section. It is impossible to define this non terminal; it must be defined every time.