clseibold / Lydrige

Lydrige is a simple statically typed interpreted programming language inspired by lisp and C.
https://www.krixano.x10host.com/projects/Lydrige/
MIT License
6 stars 0 forks source link

Better QExpressions #3

Open ghost opened 7 years ago

ghost commented 7 years ago

In version v0.6.0, we are doing a full rewrite, and with that will come better QExpressions. We should have a way to store the code in qexpressions that will make them fast and efficient to parse when being evaluated in the code. These are the few ways I have come up with to implement qexpressions in this new version:

ghost commented 7 years ago

It would also slightly improve the performance of evaluating qexpressions if we looked through the qexpression and evaluated any expressions that use constant identifiers and values. This will make sure that these types of expressions are not evaluated when the qexpression is evaluated but rather when the qexpression is declared.

For example, in this qexpression: {print (+ 3 3)}, we could automatically evaluate the expression (+ 3 3) because it doesn't use any non-constant identifiers (the + identifier is constant).