r/lua • u/TBApknoob12MC • Dec 05 '25
Project Kindaforthless : forth-ish language that compiles to lua
http://github.com/tbapknoob12mc/kindafl/So I made a forth-ish language that is, kinda forth, but less.
This is actually transpiler, like the evil typescript(for js) and moonscript/fennel(for lua).
Even chatgpt thinks this is a threat to national security.
One might even consider this as a pure evil esolang.
Example code:
l"std" (similar to #include in c)
1 2 +Will transpile to:
-- contents of std.lua:
......
-- beginning of code:
push(stack, 3)This is because of constant folding. Compiled code is optimized
Most of it was done in a weekend and i spend a week for fixing myself.
If you guys want to, roast the code to absolute pulp.
Even if its a bit off from forth, you can learn something about forth from these:
The compiler uses lazy eval(kinda, its sort of a fusion).
It has macros, too.
If you want interactive: Easyforth
More: Starting FORTH
Edit 3: add learning resources for forth
Edit 4,5 : mention <- lazy eval and optimized codegen, macros
2
u/Existing_Finance_764 Dec 05 '25
It actually transpiles, not compiles.
1
u/Radamat Dec 06 '25
What does dot in for do?
1
u/Old_County5271 Dec 07 '25
Well done, its weird to be using a low level language like forth wrapped on a high level language like this, certainly current CPUs penalize its design with performance hits, but its still a breath of fresh air reading its code v any C like language.
1
u/Radamat Dec 06 '25
Bytecode-level language.
It is hard to read without opcodes. Though it is minimalistic. Hardly practical, but good work.
0
u/AutoModerator Dec 05 '25
Hi! Your code block was formatted using triple backticks in Reddit's Markdown mode, which unfortunately does not display properly for users viewing via old.reddit.com and some third-party readers. This means your code will look mangled for those users, but it's easy to fix. If you edit your comment, choose "Switch to fancy pants editor", and click "Save edits" it should automatically convert the code block into Reddit's original four-spaces code block format for you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.