francisrstokes / arcsecond

✨Zero Dependency Parser Combinator Library for JS Based on Haskell's Parsec
555 stars 28 forks source link

Request for a language example #80

Open rishavs opened 2 years ago

rishavs commented 2 years ago

Hi

I am trying to use arcsecond for my toy language and am struggling a bit due to the lack of actual language examples to refer to. I was hoping that if the examples for some simple languages be added to the repo, it will go a long way in helping people use arcsecond for compiler projects.

While there is the BF example, because of its esoteric nature and unique syntax, it is not much use as a reference,

The languages that i feel are simple enough, and yet are very well documented, would be;

  1. Lua
  2. Lox
  3. c99

Lox would be the best example to start with IMO, as there is substantial documentation in the Crafting interpreters books about the language design and details which a lot of frontend devs would likely have gone through.

francisrstokes commented 2 years ago

This would indeed be a great addition for the library. IMO lua would be a good first example as it has a pretty simple grammar, and many existing implementations (for example: https://www.antlr3.org/grammar/1178608849736/Lua.g). Porting that grammar to arcsecond should be quite straightforward.

I don't think I will personally have enough time for this anytime soon. If you feel like taking it on (maybe as an exercise for getting into your own language), then I'd be happy to help with reviews and getting it merged into the main repo.