-
Notifications
You must be signed in to change notification settings - Fork 15
/
grammar_tac.txt
40 lines (27 loc) · 1.15 KB
/
grammar_tac.txt
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
Three Address Code Grammar
--------------------------
instruction ::= copy | load_access | store_access | load_method | unary | binary | call | branch | return .
branch ::= unconditional | conditional .
unconditional ::= "goto" LABEL .
conditional ::= "if" variable "goto" LABEL .
return ::= "return" [variable] .
copy ::= variable "=" operand .
load_access ::= variable "=" access .
store_access ::= access "=" variable .
load_method ::= variable "=" "&" TYPE "::" METHOD "(" [variable] ")" .
unary ::= variable "=" unary_op variable .
binary ::= variable "=" variable binary_op variable .
call ::= [variable "="] TYPE "::" METHOD "(" variable "," ... "," variable ")" .
access ::= static_field | instance_field | array_element | indirect .
static_field ::= TYPE "::" IDENTIFIER .
instance_field ::= variable "." IDENTIFIER .
array_element ::= variable "[" variable "]" .
indirect ::= "*" variable .
operand ::= variable | constant .
variable ::= local | temporal | derived .
derived ::= local_i .
temporal ::= "t_i" .
local ::= IDENTIFIER .
constant ::= LITERAL .
unary_op ::= "!" | "&" .
binary_op ::= "+" | "-" | ... .