fixed folder structure + lab4 less hardcode, cleanup

This commit is contained in:
2024-04-28 20:24:11 +03:00
parent b6ae645808
commit c0efefa1a1
17 changed files with 86 additions and 73 deletions

17
src/Lab6/MainParser.java Normal file
View File

@@ -0,0 +1,17 @@
package Lab6;
import java.util.List;
public class MainParser {
public static void main(String[] args) {
String input = "(3 + 5) * sqrt(16) + powtwo(5)";
List<Token> tokens = Lexer.tokenize(input);
System.out.println("Tokens:");
tokens.forEach(System.out::println);
Parser parser = new Parser(tokens);
Expr expression = parser.parse();
double result = expression.evaluate();
System.out.println("Result: " + result);
}
}