News for hackers. Stuff that matters.
Re:A Parser Combinator library for C by gopowerranger on Sunday November 01, 2015 @12:46PM (#10487267)
Hmm. So for people who don't know how to use Unix/flex/yacc?

This is just reinventing an existing wheel.

Re:A Parser Combinator library for C by gh02t on Sunday November 01, 2015 @01:08PM (#10487372)
I dunno that that's a fair criticism... by that same argument you could say yacc/bison is for people who don't know how to use C to write a parser. This looks like an attempt to do something along the lines of Parsec from Haskell, but in C.

Edit, because it looks like we hit the max reply depth: It's not like this is ever going to seriously replace Bison, I think it's just someone trying a different approach. It's not like flex/yacc/bison are the absolutely most perfect lexer/parser that can possibly exist. If people didn't try and reinvent the wheel every now and then, we'd still have stone wheels.

Re:A Parser Combinator library for C by gopowerranger on Sunday November 01, 2015 @01:19PM (#10487431)
But doing this in C already exists and works well. I don't understand the point of it. Although, in this day and age, rather than use the standard Unix toolset, people invent their own tools as if they are new. "Make" versus "npm" for example.
Re:A Parser Combinator library for C by slimsag on Sunday November 01, 2015 @03:03PM (#10487931)
Do you really think Make could replace npm?
Re:A Parser Combinator library for C by gopowerranger on Sunday November 01, 2015 @04:50PM (#10488499)
Make existed long before npm and make is the basis of all our package management in our company and our operating systems.
Re:A Parser Combinator library for C by sklogic on Sunday November 01, 2015 @07:16PM (#10489160)
Recursive descent parsing can handle different class of languages from what yacc or bison can do. It is possible to build lexerless parsers this way (so scrap your old useless flex).
Re:A Parser Combinator library for C by gopowerranger on Sunday November 01, 2015 @08:38PM (#10489432)
So your trying to say this thing does a better job?
Re:A Parser Combinator library for C by gh02t on Sunday November 01, 2015 @11:54PM (#10490065)
I seriously doubt it ever will, but you have to start somewhere.

I've used Parsec before and it is certainly nice. Honestly I think it's a bit weird to try and shoehorn it into C, but hey maybe something interesting will come out of it.

What bugs me is the suggestion that just because bison works well enough, nobody should try and make a new parser generator in C. They will probably not take over the wold, bison is big and battle tested after all, but bison is itself also a replacement for older tools. And hey, maybe mpc here will succeed and revolutionize parsing for the best; then we can have this discussion again in 20 years about someone attempting to replace it.

Re:A Parser Combinator library for C by gopowerranger on Monday November 02, 2015 @12:49AM (#10490250)
What you just said is this new thing isn't as good, and probably never will be, but you imply we should use it, even though the current tools are better.

See my complaint? If they are going to introduce a new tool, it must be better than the current tool. It's not and it's worse and not as mature.

Re:A Parser Combinator library for C by gh02t on Monday November 02, 2015 @03:12PM (#10494826)
I didn't say you should use it, nor would I. Only that it isn't pointless/futile to attempt. No tool will be as mature as bison or what have you until it has also been battle tested for 25+ years, but 25 years ago bison was also new and upcoming.

Not to mention that this is not even really a parser generator like bison or yacc... it's a combinator library. It's an entirely different way to write a parser. It's like me saying Python shouldn't exist because I know how to write C.

Re:A Parser Combinator library for C by sklogic on Monday November 02, 2015 @04:02AM (#10490780)
This one may not be that good. But any Packrat-based library is definitely much better than anything Yacc can offer.
Re:A Parser Combinator library for C by sklogic on Monday November 02, 2015 @04:01AM (#10490773)
It is different, targetting a different set of use cases.
Re:A Parser Combinator library for C by MichaelMoser123 on Sunday November 01, 2015 @07:38PM (#10489238)
In yacc the generator will tell you about shift reduce conflicts. Once you have debugged the grammar the parser is likely to work. With parser combinators you have no such assurance - you don't know if your grammar has loops, the parser might get stuck easily while parsing. However for a simple and regular input language like sexpr everything is fine.
Re:A Parser Combinator library for C by sklogic on Monday November 02, 2015 @04:06AM (#10490792)
In recursive descent you simply do not have any shift/reduce conflicts.
Re:A Parser Combinator library for C by MichaelMoser123 on Monday November 02, 2015 @03:02PM (#10494750)
you can have left recursion, or implicit left recursion in your recursive descent grammar, if you have then the parser gets stuck while parsing a clause that contains left recursion.
Re:A Parser Combinator library for C by sklogic on Monday November 02, 2015 @03:40PM (#10495044)
Firstly, this have nothing to do with shift/reduce. Secondly, you can safely handle left-recursive grammars in Packrat (which, in turn, can be implemented with combinators).
Re:A Parser Combinator library for C by MichaelMoser123 on Monday November 02, 2015 @06:15PM (#10496097)
I didn't say that left recursion has anything to do with shift reduce conflicts. Please read again.
Re:A Parser Combinator library for C by sklogic on Tuesday November 03, 2015 @04:30AM (#10498422)
I see, yes, you mentioned loops earlier. Anyway, it is not a problem for combinator-based parsing, just use Packrat with a left-recursive extension [1]

[1] http://www.vpri.org/pdf/tr2007002_packrat.pdf

Re:A Parser Combinator library for C by mveety on Monday November 02, 2015 @01:50AM (#10490426)
I know how to use lex/yacc. This is much better as lex/yacc are, frankly, miserable to use.