|
Re: Yet Another Recursive Descent Parser for C++
|
Posted: Dec 16, 2004 6:08 PM
|
|
> So is YARD an actual parser generator or is it just > a lexer generator? From your wording and the code > snippet, it looks like just a lexer generator.
YARD is a set of meta-functions for building either parsers or lexers, using meta-functions, as if writing the grammar as if writing a BNF specification.
The article at CodeProject shows only how to yield it as a lexer. I will be showing how to build an entire XML parser in the next article. Here is a preview of what the rules that will be used in the XML parser will look like:
struct Misc : public re_or3< Comment, PI, S > { };
struct prolog : public re_and3< re_opt<XMLDecl>, re_star<Misc>, re_opt< re_and< doctypedecl, re_star<Misc> > > > { }; struct document : public re_and3< prolog, element, re_star<Misc> > { };
Have I explained myself a bit better?
|
|