parser_operator.pdecparser 518 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


///Type of the expression
Enum PExprType{
	VAR
	ADD
	MULT
};

///Describes a simple mathematic expression
Class PExpr{
	///Type of the expression
	PExprType::PExprType type;
	///Name of the variable
	String varName[csVariableName];
	///Vector of operand
	Vector(PExpr) vecOperand;
}

Graph gExprVarName(PExpr e){
	e.varName e.type=PExprType::VAR
}

Operator("+", PExpr, type=PExprType::ADD, vecOperand, gExprVarName, gExprVarName)
Operator("*", PExpr, type=PExprType::MULT, vecOperand, gExprVarName, gExprVarName)