UnionCompilerDesign / compiler_core

The core of the compiler, runtime, and builder setup.
1 stars 1 forks source link

Parser - Unary Expression Tokens #102

Closed CalebLItalien closed 6 days ago

CalebLItalien commented 3 weeks ago

Details

Add the rest of the tokens required for parsing unary expressions according to #97.

Issue Type

Requirements

Notes

kjwelch commented 2 weeks ago

The current 'thing to figure out' found while completing issue #93 is implementing SyntaxElement::UnaryExpression in a way that it may be used as an operand within a SyntaxElement::BinaryExpression. The MINUS and NEGATIVE tokens were switched to a single token, DASH (effects issue #97). This had to be done, as in viewing the prior element in the lexer did not allow for variable recognition ('x' was viewed as a char and not a number if there had been assignment). In the parse_router, the dash was implemented with a helper function that checked for the binary vs unary case. This functions properly for creating '-' for binary expressions, but only works for unary expressions when outside the scope of a binary expression (-A works, but -A - B does not). This type of extralogic might be necessary for differentiating * as dereference vs multiplication and for & bitwise and address of (Also important for #97).

kjwelch commented 6 days ago

Issue completed during #93 and #57