DEV Community

Discussion on: What Are Some Good Starting Points to Learn What I Need to Write My Own Toy Language?

Collapse
 
cjbrooks12 profile image
Casey Brooks

I just started down this road myself! There's some great links and advice here already, I'll definitely be following along for more!

I've started my journey in writing compilers by first understanding how to write a good parser. I'm writing it all in Kotlin as a combinatorial Recursive Descent Parser (inspired by Haskell's Parsec, and some work I did in college), and have the parser and base functionality of evaluating an AST complete. My next step is parsing complex expressions, and then putting it all together into a toy language.

copper-leaf / kudzu

A monadic (I think...) recursive-descent parser written in Kotlin

Kudzu


A monadic (I think...) recursive-descent parser written in Kotlin

Build Status Codacy Project Grade Code Coverage

Kudzu is a recursive-descent parser written in Kotlin, with the goal of immutability and simplicity. It is mostly an exercise for me to learn more about parsing algorithms, but should work reasonably-well enough to be used for small non-trivial parsers.

Why did I write it?

I've got several projects which require custom parsing, and after looking around at the various options available in Java and Kotlin, I've decided that I would just rather write my own. Most of the ones I found either require Java 8 (a deal-breaker if I want to use it on Android), or I found them to be very complex to use, being intended for writing full-blown, high-performance compilers. I needed something simple, and I also wanted to learn how parsers work, so I decided to make my own.

This library is a parser combinator like…