r/Compilers • • May 25 '26

I built my own interpreted programming language in C from scratch

Post image

Hey r/Compilers,

I’ve been exploring interpreter and language implementation recently, so I started building Curio — a statically typed interpreted programming language written entirely from scratch in C.

One of the main goals behind the project was to design a language with syntax that feels as close to natural English as possible while still remaining relatively simple to tokenize and interpret procedurally.

English-like syntax design tradeoffsGitHub:
https://github.com/kashyap-devansh/curio

Example syntax:

make whole age
set age = 25

if age > 18 then
    print "Access granted.<nl>"
endif

The current implementation uses:

  • a handwritten tokenizer / lexer
  • a direct-dispatch interpreter
  • a custom symbol table
  • forward-scanning block resolution (endif, endwhile, etc.)
  • static type checking
  • runtime diagnostics/error reporting

One design decision that became surprisingly interesting was intentionally avoiding AST generation for now and instead executing statements directly through a dispatcher-driven execution model.

That made the implementation much simpler initially, but it also introduced interesting tradeoffs around:

  • expression handling
  • operator precedence
  • nested control flow
  • future extensibility

Another interesting challenge was balancing:

  • English-like readability vs
  • keeping the grammar simple enough for a handwritten tokenizer/interpreter architecture.

Everything is implemented manually:

  • no LLVM
  • no parser generators
  • no Flex/Bison
  • no VM/runtime libraries

Future directions I want to explore:

  • Pratt / recursive descent parsing
  • AST generation
  • bytecode + VM architecture
  • function calls and stack frames
  • better diagnostics and expression parsing

I’d especially appreciate feedback around:

  • interpreter architecture
  • parser/tokenizer design
  • direct-dispatch vs AST tradeoffs
  • language grammar decisions
  • English-like syntax design tradeoffs

GitHub:
https://github.com/kashyap-devansh/curio

Attached a small demo GIF of the language running.

92 Upvotes

27 comments sorted by

View all comments

Show parent comment

5

u/eteran May 26 '26

Hey man, I'm trying to be fair here. You asked why people think that what you've done is AI, and I gave a very specific list.

I also very directly pointed out that it is possible you've done what you've said here!

If you want people to Believe you and take you seriously, here's my advice, and I mean this. Sincerely. Show your work. And by that I mean work in relatively small commits! Don't just commit and push a finished product and throw it over the wall. Have your commit history reflect the effort that you've put in. Let's see you implement a feature... Only to find out that it needed a small tweak, so there's a follow-up commit showing the small change! Etc.

The reality is, that most projects of any reasonable scale take time and effort, if you don't show the time and effort, then people are going to assume that you used an AI.

0

u/TheIndieBuildr May 26 '26

Thanks for the advice man,

Don't take it in wrong way as you are saying I should commit on daily basis.. You can check out my second big project so far that I my own Database SQL like engine that is also made my me in C++ and you can see it's commit on the GitHub.. As from this project I was using GitHub and committing of daily basis, you can check that out ...

No harsh feelings.