pathterminuspages/projects/aboutcontactabout me

Syntax

22.08.2019

Contents/Index

Introduction
About Reversibility
@Syntax
Machinery
Semantics
Usage

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

  • Register: prefixed with $ as so: $reg1
  • Immediate values: these are integers and are just written as 1234
  • Memory references: these are written within square brackets. Both registers and immediate values can be written within a memory reference. Furthermore each argument within the memory reference can be summed, subtracted or multiplied with other arguments. Here arithmetic precedence and associativity is present. Furthermore memory references can be nested, as so [$reg1 + 100 * $reg2 - [$reg1 - $reg2]]
  • List of arguments: these are written within normal parentheses and are separated with commas as so ($reg1,$reg2)

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.

CommentsGuest Name:Comment: