Triangle Language Abstract Syntax

 

Non-terminal Symbols

Command Declaration Expression
Program Type-denoter V-Name

Start Symbol

Program

Syntax

Program  ::=  Command Program
Command  ::=  V-Name := Expression AssignCommand
| Identifier ( Expression ) CallCommand
| if Expression then Command else Command IfCommand
| while Expression do Command WhileCommand
| let Declaration in Command LetCommand
| begin Command end Command
| Command ; Command SequentialCommand
Expression  ::=  Integer-Literal IntegerExpression
| V-Name VNameExpression
| Operator Expression UnaryExpression
| Expression Operator Expression BinaryExpression
V-Name  ::=  Identifier SimpleVName
Declaration  ::=  const Identifier ~ Expression ConstDeclaration
| var Identifier : Type-denoter VarDeclaration
| Declaration ; Declaration SequentialDeclaration
Type-denoter  ::=  Identifier SimpleTypeDenoter