README.md
03 - Bindings
This module demonstrates the full power of Intuitive DSL's Binding mechanism. It shows how to transform raw user input text into strongly typed Java objects and how to handle ambiguities in the grammar.
Key Concepts
- TypeConverter: An interface used to teach the engine how to convert a lexed String into a complex object (UUID, Enum, LocalDate, etc.).
- @Bind("param_name"): Captures the value of a parameter defined in the syntax and automatically converts it to the Java field's underlying type.
- Disambiguation with after: Sometimes, a syntax uses the same parameter name multiple times (e.g., FROM list_name TO list_name). To know which value to inject into which field, we use @Bind(value="list_name", after="FROM"). The engine will look for the exact occurrence of the parameter located immediately after this keyword.
- @OnClause("CLAUSE"): Detects if a specific grammar path was taken (such as an alternative { | } or an optional flag [ ]) and assigns the boolean value true.
How to run
From your IDE
Execute the main method in the BindingsApp.java class.
From the command line
mvn clean compile exec:java