|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--fri.patterns.interpreter.parsergenerator.syntax.builder.SyntaxBuilder
Connects SyntaxSeparation and LexerBuilder. SyntaxBuilder builds a Syntax object from a text input which can be File, InputStream, Reader, String, StringBuffer. Mind that you DO NOT need a SyntaxBuilder to create a Syntax from a String [][] or a List of rule Lists!
Following symbols can be used within the syntax specification text (spaces are ignored):
a ::= b? ; // a derives to one or none b
a ::= b* ; // a derives to any number of b including zero
a ::= b+ ; // a derives to any number of b excluding zero
a ::= (b c)* d ; // grouping of b and c by parenthesis
a ::= b | c | ; // a derives to b or c or nothing
start ::= "BEGIN" ; // a fixed terminal string
letter ::= 'a' .. 'z' ; // character set a-z
newline ::= '\r' | '\n' | '\r' '\n' ; // newlines of all wellknown platforms
positive ::= digit - '0' ; // digit but not zero
id ::= `identifier` ; // using the pre-built lexer rules for identifier (lexer ruleref)
source ::= char - comment ; // source is all characters, but without comments
This EBNF-like language is case-sensitive and differs from EBNF only at these symbols:
. { } < > [ ]. Archetype was the notation used by the w3c.
| Constructor Summary | |
SyntaxBuilder(java.lang.Object syntaxInput)
Parse a syntax specification text and process it to a Syntax object. |
|
| Method Summary | |
java.util.List |
getInitialNonterminals()
Returns the list of initial nonterminals (before parenthesis and quantifiers get resolved). |
Lexer |
getLexer()
Returns a Lexer for the built syntax. |
Syntax |
getParserSyntax()
Returns only the ready-made parser syntax (to feed the parser tables). |
Syntax |
getSyntax()
Returns the whole syntax (both parser and lexer syntax). |
static void |
main(java.lang.String[] args)
Creates SyntaxBuilderParserTables.java (in this directory) from the rules defined in SyntaxBuilderSemantic. |
Syntax |
resolveSingulars()
Resolves all singular rules (only one symbol on right side, only one occurence). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SyntaxBuilder(java.lang.Object syntaxInput)
throws SyntaxException,
LexerException,
ParserBuildException,
java.io.IOException
syntaxInput - text to parse and build a syntax from, File, InputStream, Reader, String, StringBuffer.
If InputStream is used, no Reader will be wrapped around (raw byte input).| Method Detail |
public Lexer getLexer()
throws LexerException,
SyntaxException
LexerException
SyntaxException
public Syntax getParserSyntax()
throws SyntaxException
SyntaxExceptionpublic Syntax getSyntax()
public java.util.List getInitialNonterminals()
public Syntax resolveSingulars()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||