-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymbol.py
24 lines (21 loc) · 1.21 KB
/
symbol.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Project : Compilateur (Python) #
# #
# File : symbol.py #
# #
# Description : Symbol are used into the semantic analyse #
# #
# Contributors : Corentin TROADEC & Anthony Vuillemin #
# #
# Date : September 2018 #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
#CLASS SYMBOL
class Symbol:
#Declaration
def __init__(self, ident, type_symbol):
self.ident = ident
self.type = type_symbol # var or funct
self.nb_args = -1
self.nb_slot = -1
def __str__(self) :
return "[" + self.ident + "] ~ ["+self.type+"] ~ (" + str(self.nb_args) + ":" + str(self.nb_slot) + ")"