Skip to main content
The cyberduck’s pond

🦆 duckscript interpreter

·

Code your own programming language 🏗️ #

Long distance runners sometimes train with weights strapped to their ankles or at high altitudes where the atmosphere is thin. When they later unburden them- selves, the new relative ease of light limbs and oxygen-rich air enables them to run farther and faster.
Implementing a language is a real test of programming skill. The code is complex and performance critical. You must master recursion, dynamic arrays, trees, graphs, and hash tables. You probably use hash tables at least in your day-to-day programming, but do you really understand them? Well, after we’ve crafted our own from scratch, I guarantee you will.
ROBERT NYSTROM in CRAFTING INTERPRETERS

Start little 🐛 #

The current version of duckscript does not implement a lot of features. It was above all an opportunity to learn PEG parsing grammar and the basics of abstract syntax tree and interpreter.
I would have liked to add more useful features like strings, function and print, but I have certifications to pass for work.
It remains a side project that I would like to resume as soon as possible.

Currently implemented:

  • number (i64), boolean
  • + - * / % arithmetic operators
  • < > <= >= == != && || ! boolean operators
  • variables
  • if else conditional, while loop, break keyword

Implemented with pest.rs for parsing and egui for ui
The environment persists until you click on reset

look at the code! 🤓 #

@coincoingit repo.