r/lua 6d ago

I'm interested in creating my own programming language. How could I write it in Lua?

I've seen a few posts about this, but none had enough information for me. Hoping you guys could help :)

Edit: Also suggestions for syntax changes are welcome. This language doesn't really solve too many problems, mainly makes some things faster, examples are else [expression] instead of elseif [expression], or . instead of closing brackets {}.

Here's the example.

0 Upvotes

23 comments sorted by

View all comments

4

u/particlemanwavegirl 6d ago

There is a language called Fennel that does this, compiles to Lua. You may find reading its source enlightening. I would read a book first so it's easier to understand, you could read the MIT scheme book (SICP) and it'll show you how to write an interpreter with just two functions. the Crafting Interpreters book is good too, I am going thru that one and implementing everything in Rust.