Artifact Content
Not logged in

Artifact cc116d74213b45fc21f5b9ced965a76a4c55d0ac


module polemy.ast;
import polemy._common;
/*
 * Author:  k.inaba
 * License: NYSL 0.9982 (http://www.kmonos.net/nysl/
 *   Syntax tree for the polemy programming language
 */

import polemy.lex : LexPosition;

alias Statement[] Program;

abstract class Statement
{
	immutable LexPosition pos;
	mixin SimpleConstructor;
}

class DeclStatement : Statement
{
	string     var;
	Expression expr;
	mixin SimpleConstructor;
	mixin SimpleCompare; // do not take "pos" into account
}

class ExprStatement : Statement
{
	Expression expr;
	mixin SimpleConstructor;
	mixin SimpleCompare; // do not take "pos" into account
}

abstract class Expression
{
	immutable LexPosition pos;
	mixin SimpleConstructor;
	mixin SimpleCompare; // do not take "pos" into account
}

class StrLiteralExpression : Expression
{
	string data;
	mixin SimpleConstructor;
	mixin SimpleCompare; // do not take "pos" into account
}

class IntLiteralExpression : Expression
{
	BigInt data;
	mixin SimpleConstructor;
	mixin SimpleCompare; // do not take "pos" into account
}

class VarExpression : Expression
{
	string var;
	mixin SimpleConstructor;
	mixin SimpleCompare; // do not take "pos" into account
}

class BinOpExpression : Expression
{
	string op;
	Expression lhs;
	Expression rhs;
	mixin SimpleConstructor;
	mixin SimpleCompare; // do not take "pos" into account
}