Skip to content

Commit 175ff1d

Browse files
committed
fixed many bugs
1 parent 4b10234 commit 175ff1d

File tree

5 files changed

+376
-92
lines changed

5 files changed

+376
-92
lines changed

Ast.rb

+29-20
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ def initialize(commandAST,token)
1616
end
1717
end
1818

19-
class IdentifierAST < AST
19+
class TerminalAST < AST
20+
end
21+
22+
class IdentifierAST < TerminalAST
23+
attr_accessor( :typeDenoter,:decl)
2024
def initialize(token)
2125
super(token)
22-
#@astName = "identifierAST"
26+
@typeDenoter = nil
27+
@decl = nil
2328
end
2429
end
2530

@@ -32,10 +37,13 @@ def initialize(identifierAST,expressionAST,token)
3237
end
3338
end
3439

35-
class AnyTypeDenoter < TypedenoterAST
36-
40+
class TypeDenoterAST < AST
3741
end
3842

43+
#class AnyTypeDenoter < TypedenoterAST
44+
45+
#end
46+
3947
class ExpressionAST < AST
4048

4149
end
@@ -46,8 +54,7 @@ class CommandAST < AST
4654
end
4755
class DeclarationAST < AST
4856
end
49-
class TypedenoterAST < AST
50-
end
57+
5158
class ActualParameterAST < AST
5259
end
5360
class ActualParameterSequenceAST < AST
@@ -67,7 +74,7 @@ def initialize(arrayAggregateAST ,token)
6774
end
6875
end
6976

70-
class ArrayTypeDenoter < TypedenoterAST
77+
class ArrayTypeDenoter < TypeDenoterAST
7178
attr_accessor(:IL,:T)
7279
def initialize(integerLiteralAST, typeDenoterAST,token)
7380
super(token)
@@ -144,17 +151,17 @@ def CharacterExpression (characterLiteralAST,token)
144151
end
145152
end
146153

147-
class TerminalAST < AST
148-
attr_accessor(:spelling)
149-
def initialize(spelling,token)
150-
super(token)
151-
@spelling = spelling
152-
end
153-
end
154+
#class TerminalAST < AST
155+
# attr_accessor(:spelling)
156+
# def initialize(spelling,token)
157+
# super(token)
158+
# @spelling = spelling
159+
# end
160+
#end
154161
class CharacterLiteralAST < TerminalAST
155-
def initialize(spelling,token)
156-
super(spelling,token)
157-
end
162+
#def initialize(spelling,token)
163+
# super(spelling,token)
164+
#end
158165
end
159166
class CharTypeDenoterAST < TypeDenoterAST
160167

@@ -349,6 +356,10 @@ def initialize(formalParameterAST, formalParameterSequenceAST,token)
349356
end
350357
end
351358

359+
class RecordAggregateAST < AST
360+
attr_accessor(:type)
361+
end
362+
352363
class MultipleRecordAggregateAST < RecordAggregateAST
353364
attr_accessor(:I,:E,:RA)
354365
def initialize(identifierAST, expressionAST, recordAggregateAST,token)
@@ -359,9 +370,7 @@ def initialize(identifierAST, expressionAST, recordAggregateAST,token)
359370
end
360371
end
361372

362-
class RecordAggregateAST < AST
363-
attr_accessor(:type)
364-
end
373+
365374

366375
class RecordExpressionAST < ExpressionAST
367376
attr_accessor(:RA)

0 commit comments

Comments
 (0)