@author: Gautham Ganapathy @organization: LEMS (http://neuroml.org/lems/, https://github.com/organizations/LEMS) @contact: gautham@lisphacker.org
Expression parser
@author: Gautham Ganapathy @organization: LEMS (http://neuroml.org/lems/, https://github.com/organizations/LEMS) @contact: gautham@lisphacker.org
MV: added pow(f,l) function for c translations
Bases: lems.base.base.LEMSBase
Base class for a node in the expression parse tree.
Node type. @type: enum(ExprNode.OP, ExprNode.VALUE)
Bases: lems.base.base.LEMSBase
Parser class for parsing an expression and generating a parse tree.
Dictionary mapping operators to their priorities. @type: dict(string -> Integer)
Checks if a token string contains a function.
@param str: Token string to be checked. @type str: string
@return: True if the token string contains a function. @rtype: Boolean
Checks if a token string contains an operator.
@param str: Token string to be checked. @type str: string
@return: True if the token string contains an operator. @rtype: Boolean
Checks if a token string contains a symbol.
@param str: Token string to be checked. @type str: string
@return: True if the token string contains a symbol. @rtype: Boolean
MV: Added the part to recognize ** for power
Tokenizes and parses an arithmetic expression into a parse tree.
@return: Returns a token string. @rtype: lems.parser.expr.ExprNode
Expression to be parsed. @type: string
Parses a tokenized arithmetic expression into a parse tree. It calls itself recursively to handle bracketed subexpressions.
@return: Returns a token string. @rtype: lems.parser.expr.ExprNode
@attention: Does not handle unary minuses at the moment. Needs to be fixed.
List of tokens from the expression to be parsed. @type: list(string)
Bases: tvb.dsl_cuda.lems.parser.expr.ExprNode
Unary function node in an expression parse tree. This will always be a non-leaf node.
Funcion stored in this node. @type: string
Parameter. @type: lems.parser.expr.ExprNode
Bases: tvb.dsl_cuda.lems.parser.expr.ExprNode
Operation node in an expression parse tree. This will always be a non-leaf node.
Left operand. @type: lems.parser.expr.ExprNode
Operation stored in this node. @type: string
Right operand. @type: lems.parser.expr.ExprNode
Bases: tvb.dsl_cuda.lems.parser.expr.ExprNode
Value node in an expression parse tree. This will always be a leaf node.
Value to be stored in this node. @type: string