nibi-lang / nibi

An interpreted list processing language inspired by Lisp
GNU Affero General Public License v3.0
3 stars 2 forks source link

Macro expansion at parse time #135

Open bosley opened 1 year ago

bosley commented 1 year ago

When macros are called they are stringed, built and emplaced into source. This can and should be done at parse time I think. It shouldn't lead to a speed decrease, if anything, it would optimize the code. We could have all calls to macros done once, rather than every time if they are being called in a loop.

bosley commented 1 year ago

will need a way for the interpreter and parser to share macro definitions. perhaps a macro-specific env

bosley commented 1 year ago

Perhaps right when instruction ind, but this need to make macros expand out to their symbolic equivalencies before being submitted for processing. In this way they won't be executed every time they are referenced.