riff icon indicating copy to clipboard operation
riff copied to clipboard

Expression parsing cleanup

Open darrylabbate opened this issue 2 years ago • 1 comments

Most of the expression parsing logic was written during early stages of development. Long overdue for a refactor.

  • nud()/led() should return more useful information than some lexical token for calling functions to infer from.
  • Style-wise, the expression parsing should be modeled as a table of function pointers + other relevant metadata like operator precedence.

darrylabbate avatar Dec 11 '22 09:12 darrylabbate

This work should also include the internal "expression stack" that's needed for constant folding/propagation. I believe this can also be used to create a set of specialized opcodes for variable assignment. Pushing the variable address on the stack can be avoided and inlined with some OP_SET instruction in the same manner as OP_SIDXA. Simple assignments (e.g. x = 1) can be fully inlined to a mov-style instruction.

darrylabbate avatar Jan 15 '23 04:01 darrylabbate