APG
… an ABNF Parser Generator
|
APG uses a few special character types. In particular is the alphabet character type. Depending on the SABNF grammar the character size may need to be only 8 bits wide or as big as 64 bits wide or any value, 16 or 32, in between. Therefore a special alphabet character type, achar
is defined and is configurable in apg.h. The special types are:
achar - the alphabet character, configurable in apg.h aint - the working unsigned integer*, configurable in apg.h luint - the longest possible unsigned integer** abool - the APG boolean
* Pronounce AY-int, not ain't. This is the basic APG computational unit. I would have preferred to use uint
here, but uint
has a conflict with old compatibility names.
** There are a couple of places where the size of achar
and aint
need to be known at coding time but aren't known until compile time because they are configurable. One example is in the generator where space for alphabet characters must be allocated before their size is known. Another is when displaying them with a printf()
-like statement. The print formats often require knowing the integer size in advance. luint
is used to solve this problem with statements such as the following:
aint uiUnknown = 1; printf("int of unknown size is %"PRIuMAX"\n", (luint)uiUnknown);