Parses and evaluates boolean expressions. Usage:
BoolCompiler compiler = new BoolCompiler();
BoolProgram program = compiler.compile("a == b && a != c");
HashMap<String, Boolean> context = new HashMap<String, Boolean>();
context.put("a", true);
context.put("b", true);
context.put("c", false);
boolean result = program.eval(context);
System.out.println("result = "+result);
Features
- Parses C-like boolean expressions
- Expressions can contain variables
- Variables can be assigned and changed
- Evaluates expressions at a decent pace
- Can print the AST for debugging purposes
- Simple example of a recursive descent parser
Follow JavaBoolCompiler
nel_h2
Build Securely on AWS with Proven Frameworks
Moving to the cloud brings new challenges. How can you manage a larger attack surface while ensuring great network performance? Turn to Fortinet’s Tested Reference Architectures, blueprints for designing and securing cloud environments built by cybersecurity experts. Learn more and explore use cases in this white paper.
Rate This Project
Login To Rate This Project
User Reviews
Be the first to post a review of JavaBoolCompiler!