blob: 1e6de1d29cc281ef5215fe532e8723e1eee8dd14 (
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
|
from dataclasses import dataclass
from typing import Optional
from astree.type import Type
from astree.ident import Ident
from astree.expr import Expr
# A global declaration.
#
# entero a = 0;
@dataclass
class DeclGlobal:
ident: Ident
_type: Type
init: Expr
# A function declaration.
#
# funcion vacio main() { ... }
@dataclass
class DeclFunc:
ident: Ident
prototype: Type
body: Optional[Expr]
# A Javañol declaration
Decl = DeclGlobal | DeclFunc
|