820e7198cc 2010-11-07 kinaba: /** 4198578702 2010-11-07 kinaba: * Authors: k.inaba 4198578702 2010-11-07 kinaba: * License: NYSL 0.9982 http://www.kmonos.net/nysl/ 4198578702 2010-11-07 kinaba: * 4198578702 2010-11-07 kinaba: * Syntax tree for Polemy programming language. 423f308350 2010-11-07 kinaba: */ 4198578702 2010-11-07 kinaba: module polemy.ast; 4198578702 2010-11-07 kinaba: import polemy._common; 423f308350 2010-11-07 kinaba: import polemy.lex : LexPosition; 423f308350 2010-11-07 kinaba: 423f308350 2010-11-07 kinaba: alias Statement[] Program; 423f308350 2010-11-07 kinaba: 423f308350 2010-11-07 kinaba: abstract class Statement 423f308350 2010-11-07 kinaba: { 423f308350 2010-11-07 kinaba: immutable LexPosition pos; 423f308350 2010-11-07 kinaba: mixin SimpleConstructor; 423f308350 2010-11-07 kinaba: } 423f308350 2010-11-07 kinaba: 423f308350 2010-11-07 kinaba: class DeclStatement : Statement 423f308350 2010-11-07 kinaba: { 423f308350 2010-11-07 kinaba: string var; 423f308350 2010-11-07 kinaba: Expression expr; 423f308350 2010-11-07 kinaba: mixin SimpleConstructor; 423f308350 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 423f308350 2010-11-07 kinaba: } 423f308350 2010-11-07 kinaba: 423f308350 2010-11-07 kinaba: class ExprStatement : Statement 423f308350 2010-11-07 kinaba: { 423f308350 2010-11-07 kinaba: Expression expr; 423f308350 2010-11-07 kinaba: mixin SimpleConstructor; 423f308350 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 423f308350 2010-11-07 kinaba: } 423f308350 2010-11-07 kinaba: 423f308350 2010-11-07 kinaba: abstract class Expression 423f308350 2010-11-07 kinaba: { 423f308350 2010-11-07 kinaba: immutable LexPosition pos; 423f308350 2010-11-07 kinaba: mixin SimpleConstructor; 423f308350 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 423f308350 2010-11-07 kinaba: } 423f308350 2010-11-07 kinaba: 423f308350 2010-11-07 kinaba: class StrLiteralExpression : Expression 423f308350 2010-11-07 kinaba: { 423f308350 2010-11-07 kinaba: string data; 423f308350 2010-11-07 kinaba: mixin SimpleConstructor; 423f308350 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 423f308350 2010-11-07 kinaba: } 423f308350 2010-11-07 kinaba: 423f308350 2010-11-07 kinaba: class IntLiteralExpression : Expression 423f308350 2010-11-07 kinaba: { 423f308350 2010-11-07 kinaba: BigInt data; 423f308350 2010-11-07 kinaba: mixin SimpleConstructor; 423f308350 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 423f308350 2010-11-07 kinaba: } 423f308350 2010-11-07 kinaba: 423f308350 2010-11-07 kinaba: class VarExpression : Expression 423f308350 2010-11-07 kinaba: { 423f308350 2010-11-07 kinaba: string var; 423f308350 2010-11-07 kinaba: mixin SimpleConstructor; 423f308350 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 423f308350 2010-11-07 kinaba: } 423f308350 2010-11-07 kinaba: 5d4cb856d8 2010-11-07 kinaba: class AssignExpression : Expression 423f308350 2010-11-07 kinaba: { 423f308350 2010-11-07 kinaba: Expression lhs; 423f308350 2010-11-07 kinaba: Expression rhs; 5d4cb856d8 2010-11-07 kinaba: mixin SimpleConstructor; 5d4cb856d8 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 5d4cb856d8 2010-11-07 kinaba: } 3f5dc76a75 2010-11-07 kinaba: 5d4cb856d8 2010-11-07 kinaba: class FuncallExpression : Expression 5d4cb856d8 2010-11-07 kinaba: { 5d4cb856d8 2010-11-07 kinaba: Expression fun; 5d4cb856d8 2010-11-07 kinaba: Expression[] args; 5d4cb856d8 2010-11-07 kinaba: this(immutable LexPosition pos, Expression fun, Expression[] args...) 5d4cb856d8 2010-11-07 kinaba: { super(pos); this.fun=fun; this.args=args.dup; } 3f5dc76a75 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 3f5dc76a75 2010-11-07 kinaba: } 3f5dc76a75 2010-11-07 kinaba: 3f5dc76a75 2010-11-07 kinaba: class FunLiteralExpression : Expression 3f5dc76a75 2010-11-07 kinaba: { 3f5dc76a75 2010-11-07 kinaba: string[] params; 3f5dc76a75 2010-11-07 kinaba: Program funbody; 3f5dc76a75 2010-11-07 kinaba: mixin SimpleConstructor; 423f308350 2010-11-07 kinaba: mixin SimpleCompare; // do not take "pos" into account 423f308350 2010-11-07 kinaba: }