1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-12-24 00:10:09 -08:00

Add comments to the two parsing interfaces.

This commit is contained in:
Danila Fedorin 2017-07-29 21:36:39 -07:00
parent 65e8b7d15e
commit dcbda5b255
2 changed files with 19 additions and 0 deletions

View File

@ -4,7 +4,17 @@ import org.nwapw.abacus.tree.TreeNode;
import java.util.List; import java.util.List;
/**
* An itnerface that provides the ability to convert a list of tokens
* into a parse tree.
* @param <T> the type of tokens accepted by this parser.
*/
public interface Parser<T> { public interface Parser<T> {
/**
* Constructs a tree out of the given tokens.
* @param tokens the tokens to construct a tree from.
* @return the constructed tree, or null on error.
*/
public TreeNode constructTree(List<T> tokens); public TreeNode constructTree(List<T> tokens);
} }

View File

@ -2,8 +2,17 @@ package org.nwapw.abacus.parsing;
import java.util.List; import java.util.List;
/**
* Interface that provides the ability to convert a string into a list of tokens.
* @param <T> the type of the tokens produced.
*/
public interface Tokenizer<T> { public interface Tokenizer<T> {
/**
* Converts a string into tokens.
* @param string the string to convert.
* @return the list of tokens, or null on error.
*/
public List<T> tokenizeString(String string); public List<T> tokenizeString(String string);
} }