report for lab5, md form

This commit is contained in:
2024-04-28 21:59:22 +03:00
parent 869036e075
commit c368ea5d9d
19 changed files with 358 additions and 19 deletions

View File

@@ -0,0 +1,17 @@
package ParserAST;
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);
}
}