Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #33

Open
rishavs opened this issue Jan 8, 2022 · 1 comment
Open

Documentation #33

rishavs opened this issue Jan 8, 2022 · 1 comment

Comments

@rishavs
Copy link

rishavs commented Jan 8, 2022

Hi

I am very interested in using mecha for a toy language. I have never used a parser combinator before and as such am struggling with how to use it. Is there any documentation or a more robust example of mecha (something like a small language like mini-c, lua etc)?

Or can you point me to any article/tutorial which explains the kind of parser mecha is, with hopefully more examples for me to read through.
I did try to read the through the source, but mecha is super tiny and I am not sure how would I go about crafting a parser using those fundamental building blocks.

@Hejsil
Copy link
Owner

Hejsil commented Jan 8, 2022

Mecha is what you call a "parser combinator" library. It works by composing functions into new functions and is a functional programming concept (have a look at functional programming function composition).

You can have a look at the json example for something more complete. It basically maps 1 to 1 with the json parsing expression grammar (ofc, the json example is only a json validator. It does not produce a json value).

I hope you have some terms you can research from here. Mecha very much assumes that the users knows what parser combinators are and how to use them right now, so there is no "newbie" (for a lack of a better word) docs. Feel free to ask more questions here, though. I'll probably leave this issue open, so people can look at this thread for answers to common questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants