The dcode file format

dcode is a file format used to store parsed LARD programs. The compiler can read a dcode file in place of a lard source file for increased compilation time performance. This feature is used to for library files during separate compilation.

A dcode file is a byte stream. It contains three parts; a magic number that identifies it as a dcode file, a sequence of infix expression declarations, and a body declaration. The following BNF gives the deail.

dcode         ::= magic_number infix_decls '\0' expr
expr          ::= fcall_expr | num_expr | string_expr | char_expr
fcall_expr    ::= 'F' identifier args '\0'
identifier    ::= string
args          ::= { 'A' expr }*
num_expr      ::= 'N' num
string_expr   ::= 'S' string
char_expr     ::= 'C' char
string        ::= char* '\0'
infix_decls   ::= { 'I' infix_decl }*
infix_decl    ::= identifier priority associativity
priority      ::= num
associativity ::= 'L' | 'R' | 'N'
The magic number is a word that includes the LARD version numbeer. The lexemes of this BNF are num, which indicates a word stored in binary, char, which indicates a character, and the literal characters enclosed in ''.

dcode is bytesex sensitive.