aboutsummaryrefslogtreecommitdiff
path: root/compilador/astree/type.py
blob: 5389702b452f04a219d09558e59c4624cf27d3d1 (plain)
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
from dataclasses import dataclass
from typing import List
from enum import Enum

from tabla import Token

Type = None

# A built-in primitive type (int, bool, str, etc).
class BuiltinType(Enum):
    BOOLEAN = Token.BOOLEAN
    STRING = Token.STRING
    CHAR = Token.CHAR
    INT = Token.INT
    VOID = Token.VOID

# A parameter to a function type.
@dataclass
class FuncParam:
    name: str
    _type: Type

# funcion vacio ... (a: int, b: int ...)
@dataclass
class FuncType:
    result: Type
    params: List[FuncParam]

Type = BuiltinType