@@ -17,9 +17,9 @@ mixin SimplePatternMatch; } /// -class IntLiteral : AST +class Int : AST { BigInt data; mixin SimpleClass; this(LexPosition pos, int n) {super(pos); data = n;} @@ -28,31 +28,31 @@ this(LexPosition pos, string n) {super(pos); data = BigInt(n);} } /// -class StrLiteral : AST +class Str : AST { string data; mixin SimpleClass; } /// -class VarExpression : AST +class Var : AST { string name; mixin SimpleClass; } /// -class LayExpression : AST +class Lay : AST { Layer layer; AST expr; mixin SimpleClass; } /// -class LetExpression : AST +class Let : AST { string name; Layer layer; AST init; @@ -60,9 +60,9 @@ mixin SimpleClass; } /// -class FuncallExpression : AST +class App : AST { AST fun; AST[] args; this(LexPosition pos, AST fun, AST[] args...) @@ -78,9 +78,9 @@ mixin SimpleClass; } /// -class FunLiteral : AST +class Fun : AST { Parameter[] params; AST funbody; mixin SimpleClass; @@ -94,15 +94,15 @@ /// template genEast(T) { T genEast(P...)(P ps) { return new T(LexPosition.dummy, ps); } } - alias genEast!StrLiteral strl; /// - alias genEast!IntLiteral intl; /// + alias genEast!Str strl; /// + alias genEast!Int intl; /// auto fun(string[] xs, AST ps) { - return genEast!FunLiteral(array(map!((string x){return new Parameter(x,[]);})(xs)),ps); } - auto funp(Parameter[] xs, AST ps) { return genEast!FunLiteral(xs,ps); } /// - alias genEast!VarExpression var; /// - alias genEast!LayExpression lay; /// - alias genEast!LetExpression let; /// - alias genEast!FuncallExpression call; /// + return genEast!Fun(array(map!((string x){return new Parameter(x,[]);})(xs)),ps); } + auto funp(Parameter[] xs, AST ps) { return genEast!Fun(xs,ps); } /// + alias genEast!Var var; /// + alias genEast!Lay lay; /// + alias genEast!Let let; /// + alias genEast!App call; /// auto param(string name, string[] lay...) { return new Parameter(name, lay); } /// }