Syntax

Bob has a very simple syntax. Instructions are separated with newlines. Semicolons have been added as separators. An instruction is followed by zero or more arguments separated with spaces. These can be of the following types

The syntax of Bob is here presented in BNF

Lines \rightarrow \epsilon | Stmt eol Lines Stmt \rightarrow \epsilon | id StmtType StmtType \rightarrow : | Args Args \rightarrow \epsilon | reg Args | imm Args | id Args | [ ArgM ] Args | ( ArgList ) Args ArgM \rightarrow ArgM + ArgM | ArgM - ArgM | ArgM * ArgM | ArgMLit ArgMLit \rightarrow [ ArgM ] | reg | imm ArgList \rightarrow \epsilon | reg ArgListC ArgListC \rightarrow \epsilon | , reg ArgListC

It has been made to fit a SLR parser.

Share