3 ms·
It's a mistake to write your own parser because they can get so complex so quickly to even do basic stuff, and you'll lose sight of the original goal of the pro
by hacker_9 11y ago
It's a mistake to write your own parser because they can get so complex so quickly to even do basic stuff, and you'll lose sight of the original goal of the project. See Prolog - a whole programming language built around the idea of parsing language (albeit NLP)!
I suggest you take alook at Antrl4 for a powerful but easy to use parser plus lexer combo.
- ginko 11y agoI tried Antlr, even bought the book, and at least for C++ I found it pretty unworkable. Even with the book the documentation felt very incomplete. Maybe things work better on the Java side.
- bro-stick 11y agoAntlr is shit; it will waste your time for anything real. Bison+flex (once you figure out the quirks, undocumented assumptions and flags) and treetop are usable. https://www.gnu.org/software/bison/manual/ https://www.gnu.org/software/bison/manual/ http://flex.sourceforge.net/manual/ http://flex.sourceforge.net/manual/ http://treetop.rubyforge.org http://treetop.rubyforge.org Disclaimer: A long time ago in a galaxy, far, far away, I wrote an optimizing Java-to-MIPS compiler (sans GC, so leaky heap) in C++ using Flex/Bison and again in Java using JavaCC.
- bro-stick 11y agoMost apps link against PCRE.