|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.iu.cnets.klatsch.parser.Parser
public class Parser
This class contains the recursive-descent parser for the Klatsch language.
Field Summary | |
---|---|
(package private) TokenStream |
stream
|
Constructor Summary | |
---|---|
Parser(TokenStream stream)
Initializes a new parser with the given stream of tokens. |
Method Summary | |
---|---|
Expression[] |
read()
Attempts to read a program from the token stream. |
private EBlock |
readBlock()
[block] ::= BEGIN [program] END |
private EDictionary |
readDictionary()
[dictionary] ::= { [bind-list] } |
private EDo |
readDo()
[do] ::= DO [exp] WHILE [exp] |
private Expression |
readExp0()
[exp0] ::= [exp1] | [exp1] = [expression] |
private Expression |
readExp1()
[exp1] ::= [exp2] | [exp2] && [exp1] |
private Expression |
readExp10()
[exp10] ::= [exp11] | [exp11] ( [exp-list] ) | [exp11] . |
private Expression |
readExp11()
[exp11] ::= [literal] | [lvalue] | ( [expression] ) |
private Expression |
readExp2()
[exp2] ::= [exp3] | [exp3] && [exp2] |
private Expression |
readExp3()
[exp3] ::= [exp4] | ! [exp3] |
private Expression |
readExp4()
[exp4] ::= [exp5] | [exp5] == [exp4] | [exp5] != [exp4] |
private Expression |
readExp5()
[exp5] ::= [exp6] | [exp6] < [exp5] | [exp6] <= [exp5] | [exp6] > [exp5] | [exp6] >= [exp5] |
private Expression |
readExp6()
[exp6] ::= [exp7] | [exp7] + [exp6] | [exp7] - [exp6] |
private Expression |
readExp7()
[exp7] ::= [exp8] | [exp8] * [exp7] | [exp8] / [exp7] | [exp8] % [exp7] |
private Expression |
readExp8()
[exp8] ::= [exp9] | + [exp8] | - [exp8] |
private Expression |
readExp9()
[exp9] ::= [exp10] | [exp10] ** [exp9] |
private Expression |
readExpression()
[expression] ::= [exp0] | [if] | [begin] | [proc] | [while] | [do] | [for] |
private Expression[] |
readExpressionList()
[exp-list] ::= @ | [expression] , [exp-list] |
private EFor |
readFor()
[for] ::= FOR [id] IN [exp] [exp] |
private java.lang.String[] |
readIdList()
[id-list] ::= @ | [id] , [id-list] |
private EIf |
readIf()
[if] ::= IF [exp] THEN [exp] | IF [exp] THEN [exp] ELSE [exp] |
private EList |
readList()
[list] ::= [ [exp-list] ] |
private Expression |
readLiteral()
[literal] ::= [STRING] | [NUMBER] | [set] | [list] |
private Expression |
readLValue()
[lvalue] ::= [ID] |
private Pair |
readPair()
[pair] ::= [exp] : [exp] |
private Pair[] |
readPairList()
[pair-list] ::= @ | [pair] , [pair-list] |
private EProcedure |
readProc()
[proc] ::= PROC ( [id-list] ) [expression] |
private Expression[] |
readProgram()
[program] ::= @ | [expression] ; [program] |
private EWhile |
readWhile()
[while] ::= WHILE [exp] [exp] |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
TokenStream stream
Constructor Detail |
---|
public Parser(TokenStream stream)
stream
- the stream of tokensMethod Detail |
---|
public Expression[] read() throws ParserException
Expression
s on success and null if nothing could be read.
ParserException
private EBlock readBlock() throws ParserException
ParserException
private EDictionary readDictionary() throws ParserException
ParserException
private EDo readDo() throws ParserException
ParserException
private Expression readExpression() throws ParserException
ParserException
private Expression[] readExpressionList() throws ParserException
ParserException
private Expression readExp0() throws ParserException
ParserException
private Expression readExp1() throws ParserException
ParserException
private Expression readExp2() throws ParserException
ParserException
private Expression readExp3() throws ParserException
ParserException
private Expression readExp4() throws ParserException
ParserException
private Expression readExp5() throws ParserException
ParserException
private Expression readExp6() throws ParserException
ParserException
private Expression readExp7() throws ParserException
ParserException
private Expression readExp8() throws ParserException
ParserException
private Expression readExp9() throws ParserException
ParserException
private Expression readExp10() throws ParserException
ParserException
private Expression readExp11() throws ParserException
ParserException
private EFor readFor() throws ParserException
ParserException
private java.lang.String[] readIdList() throws ParserException
ParserException
private EIf readIf() throws ParserException
ParserException
private EList readList() throws ParserException
ParserException
private Expression readLiteral() throws ParserException
ParserException
private Expression readLValue() throws ParserException
ParserException
private Pair readPair() throws ParserException
ParserException
private Pair[] readPairList() throws ParserException
ParserException
private EProcedure readProc() throws ParserException
ParserException
private Expression[] readProgram() throws ParserException
ParserException
private EWhile readWhile() throws ParserException
ParserException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |