I'd like to announce the release of Java APG Version 1.0.
This is APG - An ABNF(*) Parser Generator, written entirely in the Java
language.
As I have mentioned here before, APG is remarkably similar to PEG,
even though PEG was developed by careful consideration
with mathematical proofs at each step of the way and APG by ad hoc happen
chance.
They share:
1. grammars built from parsing expressions (APG's operators)
2. disambiguation through prioritized-choice and greedy repetitions
3. syntactic predicates.

But it is item 1. that is most intriguing in its flexibility –
the ability to “invent” new expressions/operators as the problem dictates.
The addition of syntactic predicates to APG (Version 4.0) was in fact just
that,
an invented operator to match a needed but non-CFG phrase.
(After the fact, of course. Parr and Quong, and Bryan Ford beat me to it
by years.)

Java APG Version 1.0 introduces User-Defined Terminals (UDTs) which
essentially allow
the user to roll his own operators (expressions?).
Yes, you have to be careful handwriting phrase recognition
(you can easily lose track of exactly what language it is you are
recognizing)
but they are really no different from the three terminal phrases already
defined in ABNF, namely the character range, the case-insensitive literal
string
and the binary string. APG already provides handwritten recognition of those
phrases and has since Version 1.0. UDTs are also similar to semantic actions,
which most parser generators support. UDTs generalize this concept.
By standardizing their introduction into the grammar,
UDTs can also be thought of as putting semantic actions
on the same footing as the other grammar-defining operators or expressions.

Java APG, Version 1.0 includes a small library of UDTs for simple,
but often time-consuming phrases such as alphanum, white space,
C/C++-style comments and others. A number of examples are provided
which give time comparisions between the UDT and CFG versions
of some simple phrases. The time improvement factor is
sometimes negligible but for lengthy phrases can often
be in the 20s and 30s.

Released under the GPL, Java APG can be found at
www.coasttocoastresearch.com

Thanks,
Lowell Thomas

(*) ABNF - IETF RFC 4234 - is the grammar syntax used to define
most Internet standards and protocols.
Its expressiveness is similar to PEG and EBNF.



_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to