Hacker News new | past | comments | ask | show | jobs | submit login

Parsing C++ is not that hard if you use hand rolled recursive descent parser. On the other hand hacking some parser generator framework to be able to parse C++ is hard and IMO mostly pointless busywork.



Not that hard? It's literally undecidable!

https://news.ycombinator.com/item?id=21154565


That's not what 'hard' means in this context. Requiring template instantiation (or some other interplay I'm not aware of) doesn't make parsing harder - it just means it can't be done independently.

And what's more that kind of interplay is easier outside a parser framework!

Many languages are not very pure for parsing. If you're writing a parser using lex and bison this means bending over backwards to make it work.


> hacking some parser generator framework ... is hard and IMO mostly pointless busywork

Bingo. We spent decades formalising and automating something... that was never that hard in the first place.


In context of parsing the situation when all the state machine/language theory has it's place is when you have some reason to care about compiler passes and generate output while reading input. That is, when you are not constructing some intermediate in-memory representation of whole compilation unit, presumably because you are running on system with (very) limited memory. For programming language compilers this ceased to be interesting limitation in 80's.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: