rCOS/g grammar -------------- program' ::= {top-level} main-meth {top-level} top-level ::= f-decl | c-decl main-meth ::= `main' `{' [typing-list `;'] {cmd} `}' f-decl ::= `fun' `(' [type-expr-list] `)' `->' type-expr c-decl ::= `class' [x-spec-list] [ext-d] `{' {attr-def | meth-def} `}' cmd-block ::= `{' {cmd} `}' type-expr-list ::= type-expr {`,' type-expr} type-expr ::= `Int' | `Bool' | `Txt' | `&' IDENT | `&' `(' ident-list `)' | IDENT [sst] x-spec-list ::= `<' x-spec {`,' x-spec} `>' ext-d ::= `ext.' type-expr attr-def ::= [visib] typing `;' meth-def ::= IDENT `(' [typing-list] `)' cmd-block cmd ::= prim-cmd `;' | `if' `(' expr `)' cmd `else' cmd | `while' `(' expr `)' cmd | cmd-block ident-list ::= IDENT {`,' IDENT} sst ::= `<' ssti {`,' ssti} `>' x-spec ::= IDENT [`ext.' type-expr] [`impl.' type-expr] visib ::= `pub.' | `prot.' | `priv.' typing ::= type-expr IDENT typing-list ::= typing {`,' typing} prim-cmd ::= `skip' | `print' [expr-list] [`,'] | `var' typing-list | `end' ident-list | type-expr `.' `new' `(' expr `)' | expr `:=' expr | expr `.' IDENT `(' expr-list `:' ident-cast-list `:' expr-list `)' expr ::= atom-expr {`.' IDENT} | type-cast expr ssti ::= IDENT `:-' type-expr expr-list ::= expr {`,' expr} atom-expr ::= `self' | `null' | `_' | INT-LIT | BOOL-LIT | STRING-LIT | IDENT `(' [expr-list] `)' ident-cast-list ::= ident-cast {`,' ident-cast} type-cast ::= `(' type-expr `)' ident-cast ::= IDENT [type-cast] -------------- END