diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-07-23 22:58:58 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-07-23 22:58:58 -0300 |
| commit | c74cb8eaf454d9243b75e3770001d8d128356b28 (patch) | |
| tree | 899197afc0b7c382aa37c778053357e0e9b56c26 /dice-lang/src/bjc/dicelang/expr/Parser.java | |
| parent | 57f9a3bfdad20bead5b35ee540e8790e80a6b9a4 (diff) | |
Format
Diffstat (limited to 'dice-lang/src/bjc/dicelang/expr/Parser.java')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/expr/Parser.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/dice-lang/src/bjc/dicelang/expr/Parser.java b/dice-lang/src/bjc/dicelang/expr/Parser.java index 90a6b38..b3f83a4 100644 --- a/dice-lang/src/bjc/dicelang/expr/Parser.java +++ b/dice-lang/src/bjc/dicelang/expr/Parser.java @@ -52,6 +52,7 @@ public class Parser { */ final Token[] infixTokens = lex.lexString(ln, toks); System.out.println("Lexed tokens: "); + for (final Token tok : infixTokens) { System.out.println("\t" + tok); } @@ -60,9 +61,11 @@ public class Parser { * Print out infix expression. */ System.out.print("Lexed expression: "); + for (final Token tok : infixTokens) { System.out.print(tok.toExpr() + " "); } + System.out.println(); System.out.println(); @@ -71,6 +74,7 @@ public class Parser { */ final Token[] postfixTokens = Shunter.shuntTokens(infixTokens); System.out.println("Lexed tokens: "); + for (final Token tok : postfixTokens) { System.out.println("\t" + tok); } @@ -79,14 +83,17 @@ public class Parser { * Print out postfix tokens. */ System.out.print("Shunted expression: "); + for (final Token tok : postfixTokens) { System.out.print(tok.toExpr() + " "); } + System.out.println(); System.out.println(); final FunctionalList<Token> tokList = new FunctionalList<>(Arrays.asList(postfixTokens)); - final ITree<Token> ast = TreeConstructor.constructTree(tokList, tok -> tok.typ.isOperator); + final ITree<Token> ast = TreeConstructor.constructTree(tokList, + tok -> tok.typ.isOperator); /* * Print the tree, then the canonical expression for it. |
