The Artima Developer Community
Sponsored Link

Heron-Centric: Ruminations of a Language Designer
Yet Another Recursive Descent Parser for C++
by Christopher Diggins
December 16, 2004
Summary
I just finished the first version of the YARD (Yet Another Recursive Descent) Parser for C++, and posted it to CodeProject.com. The YARD parser is a simple regular expression parsing toolset which can operate on generic data.

Advertisement

The YARD (Yet Another Recursive Descent) parser is now posted online at CodeProject.com. The article describes how to use the YARD parser as a regular expression string tokenizer.

The YARD parser is a very simple regular expression pattern matcher which can match regular expression in arbitrary data. The YARD parser is designed as a simpler alternative to external tools like Bison and Flex, and is even simpler to use than the Boost Spirit Library. The YARD parser is designed differently than most RD-parsers in that it uses template meta-functions to describe the grammar productions. The grammar productions are combined using regular expression operators. It isn't as complicated as it might seem. The production rules for an identifier in Heron or C++ is expressed as:

  typedef re_or<MatchLetter, MatchChar<'_'> > MatchIdentFirstChar;
  typedef re_or<MatchIdentFirstChar, MatchNumber> MatchIdentOtherChar;
  typedef re_and<MatchIdentFirstChar, re_star<MatchIdentOtherChar> > MatchIdent;

I am currently working on an XML parser using YARD. The YARD library will be the core parsing engine for the next version of HeronFront.

Talk Back!

Have an opinion? Readers have already posted 13 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Christopher Diggins adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Christopher Diggins is a software developer and freelance writer. Christopher loves programming, but is eternally frustrated by the shortcomings of modern programming languages. As would any reasonable person in his shoes, he decided to quit his day job to write his own ( www.heron-language.com ). Christopher is the co-author of the C++ Cookbook from O'Reilly. Christopher can be reached through his home page at www.cdiggins.com.

This weblog entry is Copyright © 2004 Christopher Diggins. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use