Implement increments/decrements, as well as assign operators. #8
Labels
component:compiler
This issue is related to the Compiler and/or Bytecode.
component:parser
This issue is related to the Parser, Grammar and/or Parselets.
enhancement
New feature or request
Milestone
This issue refers to the not yet implemented operations:
i++
,++i
,i += 1
.i++
/++i
At parser level: The respective prefix/infix parselets check if the right/left expression is an property accessor, and replaces the expression with a AST that signals the operation.
At AST level: Specialized versions of
PropertyAccessExpr
/IdentifierExpr
/SubscriptAccessExpr
are created to handle this increment/decrement operations. Useprefix: Boolean, decrement: Boolean
to hold the required values.At compiler level: It is quite simple to implement all but the subscript one:
GetVariable(identifier), Increment; SetVariable(identifier)
operation.+parent, Dup. GetMember(target), Increment, SetMember(target)
.i += 1
At parser level: Handle it at the same place as the assign operations.
At AST level: Once again, specialized versions of
PropertyAccessExpr
/IdentifierExpr
/SubscriptAccessExpr
, but with an enum signifying which assign operations.At compiler level: Same hassle as increment/decrement.
The text was updated successfully, but these errors were encountered: