3 ms·
Show HN: I wrote a Logo interpreter using JavaScript
Hi everyone -
I wrote a Logo interpreter in JavaScript, no regex, no external libraries. https://logo-lang.pages.dev https://logo-lang.pages.dev
I wanted to understand how interpreters work but I struggled with the regex that's used to implement parsers for most interpreters.
Logo's syntax is simple and it allowed me to implement it without regex. There are no external libraries - SVG is used for drawings.
I wrote a short book about the project: https://alabhya.gumroad.com/l/logo https://alabhya.gumroad.com/l/logo
Source: https://github.com/alabhyajindal/logo https://github.com/alabhyajindal/logo
- Leftium 2y agoIs your Logo interpreter implemented as a functional language? I was introduced to Logo in 1st grade. (Moving the turtle around to draw stuff...) - Years later: when learning how to program, my mind was blown when I found out I was actually already programming in 1st grade. - Years after that: while learning functional programming, my mind was blown again when I discovered Logo is actually a functional language[1]. [1]: https://www.wikiwand.com/en/Logo_(programming_language) https://www.wikiwand.com/en/Logo_(programming_language)
- alabhyajindal 2y agoI had a very similar experience! Learning Logo in 1st grade and rediscovering it later. Logo is a functional language but I have impemented it in an imperative fashion. I look at the entered commands and process them one by one.