Live data from Hacker News

Parsing: The Solved Problem That Isn't (2011)

tratt.net

1–10 of 71 posts

Re: Parsing: The Solved Problem That Isn't (2011)

#2
I just found this "old" article looking for an easy to use parser in C++ (in Visual Studio, GCC, and CLang). I think the current state of parsers in C++ is... how to say it... terrible! flex and bison doesn't look like C++, Boost Spirit too much ado, ANTLR4 doesn't support it yet and setting up ANTLR3 in Visual Studio can be explained in a few steps if it were explained in a straightforward way.

When you look at the simplicity of OMeta[1] you feel the difference. But I am not aware of any (production ready) OMeta implementation for C++.

[1] http://tinlizzie.org/ometa/

Re: Parsing: The Solved Problem That Isn't (2011)

#3
post #2

I just found this "old" article looking for an easy to use parser in C++ (in Visual Studio, GCC, and CLang). I think the current state of parsers in C++ is... how to say it... terrible! flex and bison doesn't look like C++, Boost Spirit too much ado, ANTLR4 doesn't support it yet and setting up ANTLR3 in Visual Studio can be explained in a few steps if it were explained in a straightforward way. When you look at the…

If you don't mind incredibly long compile times for any moderately complex grammar, PEGTL is pretty straightforward compared to other alternatives.

Re: Parsing: The Solved Problem That Isn't (2011)

#4
post #2

I just found this "old" article looking for an easy to use parser in C++ (in Visual Studio, GCC, and CLang). I think the current state of parsers in C++ is... how to say it... terrible! flex and bison doesn't look like C++, Boost Spirit too much ado, ANTLR4 doesn't support it yet and setting up ANTLR3 in Visual Studio can be explained in a few steps if it were explained in a straightforward way. When you look at the…

The 'Accent' compiler-compiler can have some advantages over yacc.

http://accent.compilertools.net

Re: Parsing: The Solved Problem That Isn't (2011)

#5
post #4
post #2

I just found this "old" article looking for an easy to use parser in C++ (in Visual Studio, GCC, and CLang). I think the current state of parsers in C++ is... how to say it... terrible! flex and bison doesn't look like C++, Boost Spirit too much ado, ANTLR4 doesn't support it yet and setting up ANTLR3 in Visual Studio can be explained in a few steps if it were explained in a straightforward way. When you look at the…

The 'Accent' compiler-compiler can have some advantages over yacc. http://accent.compilertools.net

Thanks, I didn't have it on my list! I will try it.

Re: Parsing: The Solved Problem That Isn't (2011)

#6
post #2

I just found this "old" article looking for an easy to use parser in C++ (in Visual Studio, GCC, and CLang). I think the current state of parsers in C++ is... how to say it... terrible! flex and bison doesn't look like C++, Boost Spirit too much ado, ANTLR4 doesn't support it yet and setting up ANTLR3 in Visual Studio can be explained in a few steps if it were explained in a straightforward way. When you look at the…

If you don't mind incredibly long compile times for any moderately complex grammar, PEGTL is pretty straightforward compared to other alternatives.

http://code.google.com/p/pegtl/

Re: Parsing: The Solved Problem That Isn't (2011)

#7
My day job used to involve parsing some fairly ill-formed languages, so I developed this: https://github.com/Logicalshift/TameParse

I noticed with the languages I was working on, the problems could be resolved by being smarter with the lookahead: this parser allows for context-free lookahead matching to resolve (or detect and defer) ambiguities.

That makes it possible to do neat things like parse C snippets without full type information or deal with keywords that aren't always keywords (eg, await in C#).

Re: Parsing: The Solved Problem That Isn't (2011)

#8
I've wondered why most existing LALR(1) parser generators are not replaced with LR parser generators with a higher look-ahead than 1. This improvement, considering that our computational power today does not justify these restrictions any more, would be Pareto-optimal even while it is being decided what completely alternative strategies (PEGs, boolean grammars, parser combinators, etc.) will take over.

Re: Parsing: The Solved Problem That Isn't (2011)

#10
post #8

I've wondered why most existing LALR(1) parser generators are not replaced with LR parser generators with a higher look-ahead than 1. This improvement, considering that our computational power today does not justify these restrictions any more, would be Pareto-optimal even while it is being decided what completely alternative strategies (PEGs, boolean grammars, parser combinators, etc.) will take over.

ANTLR is LL(*).
Post reply on HN