diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2016-06-16 20:21:25 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2016-07-26 19:47:02 +0300 |
| commit | d35a37a449d31e6f4b43b937abf7b0e1fc497828 (patch) | |
| tree | 8d65ac1068dbf09de480e7cae0fb39ec21d330ec /main/core/parser/ASTGenerator.java | |
| parent | f441022881945db08846e09a8f3bfee2f8cfa95d (diff) | |
Grammar now uses reverse polish notation
Diffstat (limited to 'main/core/parser/ASTGenerator.java')
| -rw-r--r-- | main/core/parser/ASTGenerator.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/main/core/parser/ASTGenerator.java b/main/core/parser/ASTGenerator.java new file mode 100644 index 0000000..e0a3146 --- /dev/null +++ b/main/core/parser/ASTGenerator.java @@ -0,0 +1,30 @@ +package com.jantuomi.interpreter.main.core.parser; + +import com.jantuomi.interpreter.main.core.parser.ast.ASTNode; +import com.jantuomi.interpreter.main.core.tokenizer.token.Token; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by jan on 16.6.2016. + */ +public class ASTGenerator { + private static final ASTGenerator instance = new ASTGenerator(); + + private ASTGenerator() {} + + public static ASTGenerator getInstance() { + return instance; + } + + public List<ASTNode> generate(List<Token> trees) { + List<ASTNode> list = new ArrayList<>(); + + for (Token root : trees) { + list.add(root.generateNode()); + } + + return list; + } +} |
