riff-lang / riff

The Riff programming language
https://riff.cx
BSD Zero Clause License
23 stars 1 forks source link

Expression parsing cleanup #49

Open darrylabbate opened 1 year ago

darrylabbate commented 1 year ago

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

darrylabbate commented 1 year ago

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.