-
Notifications
You must be signed in to change notification settings - Fork 2
/
lang.def
52 lines (45 loc) · 1.65 KB
/
lang.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# AST Definition file for language
#
# Format: ParentNode => Child Child ... Child
#
# Single Quote after arrow means that the node should indent and linebreak its children
# Asterisk means zero or more of that child (a std::list)
# Question mark means optional child (may be NULL)
# Other children may not be NULL or a std::list
#
# genast.py reads and processes this file
#
Program =>' *Class
Class =>' Identifier ?Identifier *Declaration *Method
Method =>' Identifier *Parameter Type MethodBody
MethodBody =>' *Declaration *Statement ?ReturnStatement
Parameter => Type Identifier
Declaration => Type *Identifier
ReturnStatement => Expression
Statement:Assignment => Identifier ?Identifier Expression
Statement:Call => MethodCall
Statement:IfElse =>' Expression *Statement *Statement
Statement:While =>' Expression *Statement
Statement:Repeat =>' *Statement Expression
Statement:Print => Expression
Expression:Plus => Expression Expression
Expression:Minus => Expression Expression
Expression:Times => Expression Expression
Expression:Divide => Expression Expression
Expression:Less => Expression Expression
Expression:LessEqual => Expression Expression
Expression:Equal => Expression Expression
Expression:And => Expression Expression
Expression:Or => Expression Expression
Expression:Not => Expression
Expression:Negation => Expression
Expression:MethodCall => Identifier ?Identifier *Expression
Expression:MemberAccess => Identifier Identifier
Expression:Variable => Identifier
Expression:IntegerLiteral => Integer
Expression:BooleanLiteral => Integer
Expression:New => Identifier *Expression
Type:IntegerType =>
Type:BooleanType =>
Type:ObjectType => Identifier
Type:None =>