Mercurial > projects > dang
diff ast/Decl.d @ 1:2168f4cb73f1
First push
author | johnsen@johnsen-desktop |
---|---|
date | Fri, 18 Apr 2008 02:01:38 +0200 |
parents | |
children | e331e4e816e4 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ast/Decl.d Fri Apr 18 02:01:38 2008 +0200 @@ -0,0 +1,58 @@ +module ast.Decl; + +import ast.Exp, + ast.Stmt; + +import lexer.Token; + +import sema.SymbolTable; + +enum DeclType +{ + VarDecl, + FuncDecl, +} + +class Decl +{ + this(DeclType declType) + { + this.declType = declType; + } + + DeclType declType; + Scope env; +} + +class VarDecl : Decl +{ + this(Identifier type, Identifier identifier, + Exp e = null) + { + super(DeclType.VarDecl); + this.type = type; + this.identifier = identifier; + this.init = e; + } + + Identifier type, identifier; + Exp init; +} + +class FuncDecl : Decl +{ + this(Identifier type, Identifier identifier, + VarDecl[] funcArgs, Stmt[] statements) + { + super(DeclType.FuncDecl); + this.type = type; + this.identifier = identifier; + this.funcArgs = funcArgs; + this.statements = statements; + } + + Identifier type, identifier; + VarDecl[] funcArgs; + Stmt[] statements; +} +