.TH ppg Onyx
.SH NAME
ppg \- A predicate parser generator
.SH SYNOPSYIS
.nf
class ppg : public Parser {
	int indent;
	Text *stack;
	char *classname;
	char *parent;
	Text *manual;
	char *manline;
	int  man_flag;
	        
	void add(char *str);
	void flush();
	void printlf(int offs);
	
	ppg(LineStream *InitStream);
	virtual ~ppg();
	
	int cbody();
	int cheader();
	int token();
	int list();
	int choice();
	int option();
	int loop();
	int formula();
	int def();
	int include();
	int classes();
	int definitions();
	int grammar();
	virtual int line_comment();
	}
.fi
.SH DESCRIPTION
Oh no YetAnotherCC you say :-) No this in not like yacc for LR-grammars
but for LL-grammars only, so it produces readable code, like hand written.

Unlike YACC its written in C++ and each parser is a object class, so
its easy posible to use different grammars in one program without side
effects.

Symbolmeaning
.TP
#
Introduces normal English text. This is used when the defini-
tion of a syntactic element is not expressed in BNF.
.TP
WORD
A word means a non terminal.
.TP
" "
Doublequotes delimit character strings that are
terminal symbols of the language.
.TP
:
The definition operator. This is used in a production rule to
separate the element defined by the rule from its definition.
The element being defined appears to the left of the opera-
tor and the formula that defines the element appears to the
right.
.TP
;
The semicolon indicate the end of a formula.
.TP
[ ]
Square brackets indicate optional elements in a formula.
.TP
( )
Parens are like brackets but the elements can be repeated.
.TP
{ }
Braces include C-Statements witch 'll be executed when hit.
.TP
|
The alternative operator. The vertical bar indicates that
the portion of the formula following the bar is an alterna-
tive to the portion preceding the bar. If the vertical bar
appears at a position where it is not enclosed in braces
or square brackets, it specifies a complete alternative for
the element defined by the production rule. If the vertical
bar appears in a portion of a formula enclosed in braces or
square brackets, it specifies alternatives for the contents
of the innermost pair of such braces or brackets.
.TP
!
The loop indicator marks a coice which indicates the 
reason for coninuing the loop. If the loop indicator is
ommited the first choice in the loop is the reason.
At Example : 
( id ! "," )
means that ids folowed by commas are reagular and a missing
comma stopps the loop.

Predefined Lexial elements :
.TP
id
matches words started with a letter, and continued by
letters, numbers the underscore, and charakters above
ascii(127)
.TP
num
matches words started with a letter or a dash, and continued
by letters or periods.
.TP
match
This is a tricky thing. These function looks for last
terminal token and tries to match a right side of it.
Only tokens of quote or paren kind can ba matched.
.TP
error
This makes a error, and normaly exits the parser if
not overloaded.
.PP
You can uses lexical element from c statements by accesing
the class variables p_val or p_matched.

Comment checking :
.TP
comment
this is called everytime after when next is called
so comments can be at any place, the # for line_comments
can be overloaded.
.SH IMPLEMENTATION
.PP
token : 
.br
.in +0.8i
.ad l
.nh
id  [ ":" ":" id  ] | "\(rs"" match  "\(rs"" 
.br
;
.br
.hy
.PP
list : 
.br
.in +0.8i
.ad l
.nh
token  ( loop  | option  | token  | cbody  ) 
.br
;
.br
.hy
.PP
choice : 
.br
.in +0.8i
.ad l
.nh
list  ( "|" list  ) 
.br
;
.br
.hy
.PP
option : 
.br
.in +0.8i
.ad l
.nh
"[" choice  "]" 
.br
;
.br
.hy
.PP
loop : 
.br
.in +0.8i
.ad l
.nh
"(" [ cbody  ] choice  [ "!" choice  ] ")" 
.br
;
.br
.hy
.PP
formula : 
.br
.in +0.8i
.ad l
.nh
choice  | option  [ cbody  ] | loop  [ cbody  ] | cbody  formula  
.br
;
.br
.hy
.PP
def : 
.br
.in +0.8i
.ad l
.nh
id  ":" formula  
.br
;
.br
.hy
.PP
cheader : 
.br
.in +0.8i
.ad l
.nh
"{" match  "}" 
.br
;
.br
.hy
.PP
cbody : 
.br
.in +0.8i
.ad l
.nh
"{" match  "}" 
.br
;
.br
.hy
.PP
include : 
.br
.in +0.8i
.ad l
.nh
[ "include" ( "\(rs"" match  "\(rs"" ! "include" ) ] 
.br
;
.br
.hy
.PP
classes : 
.br
.in +0.8i
.ad l
.nh
"class" id  [ ":" id  ] cheader  
.br
;
.br
.hy
.PP
definitions : 
.br
.in +0.8i
.ad l
.nh
def  ( ";" def  ) "." 
.br
;
.br
.hy
.PP
grammar : 
.br
.in +0.8i
.ad l
.nh
include  classes  include  definitions  [ cbody  ] 
.br
;
.br
.hy
.SH "SEE ALSO"
parser(Onyx)
.SH AUTHOR
Michael Koehne <kraehe@bakunin.north.de>
