Live data from Hacker News

Owl: Parser generator for visibly pushdown languages

github.com

1–10 of 34 posts

Re: Owl: Parser generator for visibly pushdown languages

#2
I've been looking at parser generators recently in an effort to begin writing my own simple interpreted language.

My end goal is a self hosted language.

My first attempt was writing a recursive descent parser by hand: https://gist.github.com/cmcarey/eee1571721141c356d4f61b453a6...

This didn't work so well (badly structured as well as finding out my grammar was ambiguous after I'd written 600 lines of parser code).

Looking into alternative ways to write a parser, I've seen the usual yacc/bison/ANTLR type tools and relevant discussions here on HN.

Owl looks fantastic and probably exactly what I'm looking for. Fantastic interactive page where you enter the grammar and code and it shows a visual representation of the parse tree: https://ianh.github.io/owl/try/#example

Re: Owl: Parser generator for visibly pushdown languages

#3
post #2

I've been looking at parser generators recently in an effort to begin writing my own simple interpreted language. My end goal is a self hosted language. My first attempt was writing a recursive descent parser by hand: https://gist.github.com/cmcarey/eee1571721141c356d4f61b453a6... This didn't work so well (badly structured as well as finding out my grammar was ambiguous after I'd written 600 lines of parser code). Lo…

I'm in the same boat. I've found https://github.com/harc/ohm to be a pretty pleasant grammar and parser to use.

Ohm also has a nice interactive editor: https://ohmlang.github.io/editor/

Re: Owl: Parser generator for visibly pushdown languages

#4
post #2

I've been looking at parser generators recently in an effort to begin writing my own simple interpreted language. My end goal is a self hosted language. My first attempt was writing a recursive descent parser by hand: https://gist.github.com/cmcarey/eee1571721141c356d4f61b453a6... This didn't work so well (badly structured as well as finding out my grammar was ambiguous after I'd written 600 lines of parser code). Lo…

You might also be interested in Perl6's grammars:

https://docs.perl6.org/language/grammars#Creating_grammars

Re: Owl: Parser generator for visibly pushdown languages

#5
post #2

I've been looking at parser generators recently in an effort to begin writing my own simple interpreted language. My end goal is a self hosted language. My first attempt was writing a recursive descent parser by hand: https://gist.github.com/cmcarey/eee1571721141c356d4f61b453a6... This didn't work so well (badly structured as well as finding out my grammar was ambiguous after I'd written 600 lines of parser code). Lo…

The interactive part is genius.

Re: Owl: Parser generator for visibly pushdown languages

#6
post #2

I've been looking at parser generators recently in an effort to begin writing my own simple interpreted language. My end goal is a self hosted language. My first attempt was writing a recursive descent parser by hand: https://gist.github.com/cmcarey/eee1571721141c356d4f61b453a6... This didn't work so well (badly structured as well as finding out my grammar was ambiguous after I'd written 600 lines of parser code). Lo…

have a look at https://lark-parser.readthedocs.io/en/latest/

like Ohm it separates the grammar from the semantic actions

Re: Owl: Parser generator for visibly pushdown languages

#7
post #2

I've been looking at parser generators recently in an effort to begin writing my own simple interpreted language. My end goal is a self hosted language. My first attempt was writing a recursive descent parser by hand: https://gist.github.com/cmcarey/eee1571721141c356d4f61b453a6... This didn't work so well (badly structured as well as finding out my grammar was ambiguous after I'd written 600 lines of parser code). Lo…

Check out Prolog DCGs

https://en.wikipedia.org/wiki/Definite_clause_grammar

http://www.amzi.com/manuals/amzi/pro/ref_dcg.htm

https://www.metalevel.at/prolog/dcg

http://www.pathwayslms.com/swipltuts/dcg/

Re: Owl: Parser generator for visibly pushdown languages

#9
post #2

I've been looking at parser generators recently in an effort to begin writing my own simple interpreted language. My end goal is a self hosted language. My first attempt was writing a recursive descent parser by hand: https://gist.github.com/cmcarey/eee1571721141c356d4f61b453a6... This didn't work so well (badly structured as well as finding out my grammar was ambiguous after I'd written 600 lines of parser code). Lo…

Try PEGs

https://parsley.readthedocs.io/en/latest/tutorial.html https://en.wikipedia.org/wiki/OMeta

Re: Owl: Parser generator for visibly pushdown languages

#10
post #9
post #2

I've been looking at parser generators recently in an effort to begin writing my own simple interpreted language. My end goal is a self hosted language. My first attempt was writing a recursive descent parser by hand: https://gist.github.com/cmcarey/eee1571721141c356d4f61b453a6... This didn't work so well (badly structured as well as finding out my grammar was ambiguous after I'd written 600 lines of parser code). Lo…

Try PEGs https://parsley.readthedocs.io/en/latest/tutorial.html https://en.wikipedia.org/wiki/OMeta

Absolutely! Furthermore, https://github.com/harc/ohm is the successor to OMeta.
Post reply on HN