module examples::calc::Syntax
rascal-0.40.16
typepal-0.14.8
Usage
import examples::calc::Syntax;
Source code
http://github.com/usethesource/typepal/src/examples/calc/Syntax.rsc
Dependencies
extend examples::CommonLex;
syntax Calc
start syntax Calc
= Decl+ ❷
;
syntax Decl
syntax Decl
= "var" Id "=" Exp ";" ❸
;
syntax Exp
syntax Exp
= Id ❹
| Integer ❺
| Boolean ❻
| bracket "(" Exp ")" ❼
> left Exp "*" Exp ❽
> left Exp "+" Exp ❾
> "if" Exp "then" Exp "else" Exp ❶⓿
;
syntax Reserved
keyword Reserved
= "var" | "if" | "then" | "else"
;