-
Notifications
You must be signed in to change notification settings - Fork 0
/
AST2.rb
72 lines (67 loc) · 3.95 KB
/
AST2.rb
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'Magia'
module Yisiel; end
$ast_type_tree = [
["AST" , %w[ ], [
["Prog" , %w[definiciones procedimientos instrucciones ], []],
["Def" , %w[ident line col ], [
["Value" , %w[ ], []],
["Array" , %w[size ], []]
]],
["Proc" , %w[ident line col parametros definiciones instruccion], []],
["Param" , %w[ident line col ], [
["In" , %w[ ], []],
["Out" , %w[ ], []],
]],
["Stmt" , %w[ ], [
["Skip" , %w[ ], []],
["Set" , %w[lvalues expresiones ], []],
["If" , %w[casos ], []],
["Do" , %w[casos ], []],
["Block" , %w[instrucciones ], []],
["Call" , %w[ident line col expresiones ], []],
["Ret" , %w[ ], []],
["Show" , %w[ ], [
["Math" , %w[expresion ], []],
["Str" , %w[string ], []]
]]
]],
["LValue" , %w[ ], [
["Value" , %w[ident line col ], []],
["Array" , %w[ident line col expresion ], []]
]],
["Caso" , %w[predicado instruccion ], []],
["Math" , %w[ ], [
["Add" , %w[lhs rhs ], []],
["Sub" , %w[lhs rhs ], []],
["Mod" , %w[lhs rhs ], []],
["Prod" , %w[lhs rhs ], []],
["Div" , %w[lhs rhs ], []],
["Num" , %w[numero ], []],
["Neg" , %w[expresion ], []],
["Size" , %w[ident line col ], []],
["Def" , %w[ ], [
["Value", %w[ident line col ], []],
["Array", %w[ident line col expresion ], []]
]]
]],
["Bool" , %w[ ], [
["L" , %w[lhs rhs ], []],
["LE" , %w[lhs rhs ], []],
["G" , %w[lhs rhs ], []],
["GE" , %w[lhs rhs ], []],
["E" , %w[lhs rhs ], []],
["NE" , %w[lhs rhs ], []],
["And" , %w[lhs rhs ], []],
["Or" , %w[lhs rhs ], []],
["Not" , %w[predicado ], []],
["True" , %w[ ], []],
["False" , %w[ ], []]
]]
]]
]
# Definición de todos los tipos usados por el árbol.
Magia::define_types($ast_type_tree, Yisiel)
class Yisiel::AST
# def check; end
# def run ; end
end