diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-11-25 12:11:08 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-11-25 12:11:08 -0600 |
commit | eb4a3019bc0251e5b2b8229679e3c65d61d55336 (patch) | |
tree | f6b2a89dd35374272bd671933bfe87da4a587215 /compilador/astree/decl.py | |
parent | 6b4e9a4e95eb511c194200e38ee323091dc5d7d2 (diff) | |
download | javanol-eb4a3019bc0251e5b2b8229679e3c65d61d55336.tar.gz javanol-eb4a3019bc0251e5b2b8229679e3c65d61d55336.tar.bz2 javanol-eb4a3019bc0251e5b2b8229679e3c65d61d55336.zip |
Buen progreso, pero se cicla
Diffstat (limited to 'compilador/astree/decl.py')
-rw-r--r-- | compilador/astree/decl.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/compilador/astree/decl.py b/compilador/astree/decl.py new file mode 100644 index 0000000..1e6de1d --- /dev/null +++ b/compilador/astree/decl.py @@ -0,0 +1,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 |