Skip to content

Commit

Permalink
Adicionei comentários
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpeixoto committed Jan 13, 2023
1 parent 9f4b8f8 commit 22a2c02
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lat/parsing/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,10 @@ def p_error(p):
sys.exit(1)


# Inicializar yacc
parser = yacc.yacc()

# Inicializar handlers
parser.primary_handler = Primary()
parser.unary_handler = Unary()
parser.factor_handler = Factor()
Expand All @@ -851,7 +853,6 @@ def p_error(p):
parser.condition_handler = Condition()
parser.subexpression_handler = SubExpression()
parser.expression_handler = Expression()

parser.io_handler = IO()
parser.assignment_handler = Assignment()
parser.declaration_handler = Declaration()
Expand All @@ -860,17 +861,13 @@ def p_error(p):
parser.match_handler = Match()
parser.loop_handler = Loop()
parser.loop_break_handler = BreakContinue()

parser.functions_handler = Functions()

# Inicializar variáveis
parser.num_params = 0
parser.num_args = []

parser.frame_count = 0
parser.global_count = 0
parser.current_scope: Scope = Scope(name="Global Scope", level=0, parent=None)

parser.type_checker = TypeCheck()

parser.if_count = 0
parser.rel_if_count = 0
parser.match_count = 0
Expand All @@ -881,6 +878,13 @@ def p_error(p):
parser.indexing_depth = []
parser.arr_dim = []

# Inicializar scope
parser.current_scope: Scope = Scope(name="Global Scope", level=0, parent=None)

# Inicializar type checker
parser.type_checker = TypeCheck()


if __name__ == "__main__":
for line in sys.stdin:
parser.parse(line)

0 comments on commit 22a2c02

Please sign in to comment.