Mercurial > projects > dang
view ast/Stmt.d @ 5:2c5a8f4c254a
Added very simple if support.
* No else
* Still no logical operators, always tests != 0
author | Anders Halager <halager@gmail.com> |
---|---|
date | Fri, 18 Apr 2008 11:46:00 +0200 |
parents | 2168f4cb73f1 |
children | 642c6a998fd9 |
line wrap: on
line source
module ast.Stmt; import ast.Exp, ast.Decl; import sema.SymbolTable; enum StmtType { Stmt, Decl, Exp, Return, If, } class Stmt { this(StmtType stmtType = StmtType.Stmt) { this.stmtType = stmtType; } StmtType stmtType; Scope env; } class ReturnStmt : Stmt { this() { super(StmtType.Return); } public Exp exp; } class DeclStmt : Stmt { this(Decl decl) { super(StmtType.Decl); this.decl = decl; } public Decl decl; } class ExpStmt : Stmt { this(Exp exp) { super(StmtType.Exp); this.exp = exp; } public Exp exp; } class IfStmt : Stmt { this(Exp cond, Stmt[] then) { super(StmtType.If); this.cond = cond; this.then = then; } Exp cond; Stmt[] then; }