Language Processing
v2.0

pj2
Class BnfBuilder

Object
  extended by BnfBuilder
Direct Known Subclasses:
RfcBuilder

public class BnfBuilder
extends Object

builder for recognizer built from bnf.rfc.

Version:
2.0.1

Field Summary
protected  Parser parser
          factory for the tree to represent the grammar.
 
Constructor Summary
BnfBuilder()
           
 
Method Summary
 Parser.Id id(int position, List args)
          id: Id;
 Parser.Level level(int position, List args)
          level: '%' Id ( id | literal )+ ';'; The first Id must be left, right, or nonassoc.
 Parser.Literal literal(int position, List args)
          literal: Literal;
 Parser parser(List args)
          parser: Prolog rule+ Epilog;
 Parser.Node prec(int position, List args)
          prec: '%' Id ( id | literal ); The first Id must be prec.
 Parser.Node rule(int position, List args)
          rule: type?
 Parser.Node sequence(int position, List args)
          sequence: term+ prec?
 Parser.Type type(int position, List args)
          type: '<' Id ( ':' Id +/ ',' )?
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parser

protected Parser parser
factory for the tree to represent the grammar.

Constructor Detail

BnfBuilder

public BnfBuilder()
Method Detail

parser

public Parser parser(List args)
parser: Prolog rule+ Epilog;

Returns:
the complete parser or null on error.

rule

public Parser.Node rule(int position,
                        List args)
rule: type? Id ( pattern | rhs ) ';' | level;
pattern: '=' String;
rhs: ':' ( '|'? sequence +/ '|' )?;

Returns:
Level, Pattern, or Rule.

type

public Parser.Type type(int position,
                        List args)
type: '<' Id ( ':' Id +/ ',' )? '>' '?'?;

Returns:
Parser.Type.

sequence

public Parser.Node sequence(int position,
                            List args)
sequence: term+ prec?;


id

public Parser.Id id(int position,
                    List args)
id: Id;


literal

public Parser.Literal literal(int position,
                              List args)
literal: Literal;


prec

public Parser.Node prec(int position,
                        List args)
prec: '%' Id ( id | literal );

The first Id must be prec.

Returns:
Parser.Literal or Parser.Pattern Parser.Id.

level

public Parser.Level level(int position,
                          List args)
level: '%' Id ( id | literal )+ ';';

The first Id must be left, right, or nonassoc.



(c) 2008 Axel T. Schreiner