Skip to main content

module examples::untypedFun::Syntax

rascal-0.40.16
typepal-0.14.8

Usage

import examples::untypedFun::Syntax;

Source code

http://github.com/usethesource/typepal/src/examples/untypedFun/Syntax.rsc

Dependencies

extend examples::CommonLex;

syntax Expression

start syntax Expression 
=
Id name
| Integer intcon
| Boolean boolcon
| String strcon
| bracket "(" Expression e ")"
> left ( Expression lhs "+" Expression rhs
| Expression lhs "&&" Expression rhs
)
| "fun" Id arg "{" Expression exp "}"
> left Expression exp1 "(" Expression exp2 ")"
| "let" Id name "=" Expression exp1 "in" Expression exp2 "end"
| "if" Expression cond "then" Expression thenPart "else" Expression elsePart "fi"
;

syntax Reserved

keyword Reserved 
= "if" | "then" | "else" | "fi" |
"let" | "in" | "fun" | "end" |
"int" | "bool"
;