Annotations Reference

The Intuitive DSL Engine uses a set of lightweight, pure Java annotations to bridge your iBNF grammar with your executable code. These annotations are processed at startup to build the internal Symbol Graph and cache injection handles.

1. @DslCommand

The primary annotation used to register a class as an executable command.

  • Target: Type (Class)
  • Attributes:
    • name (String): The logical name of the command for registry indexing.
    • syntax (String): The iBNF grammar definition.
@DslCommand(
    name = "LOGOUT",
    syntax = "LOGOUT user_id [ FORCE ] ;"
)
public class LogoutCommand implements Runnable { ... }

2. @Bind

Binds a dynamic parameter from the grammar to a Java field or method. The engine automatically performs type conversion (e.g., String to Integer).

  • Target: Field, Parameter, or Method
  • Attributes:
    • value (String): The name of the parameter in the iBNF (must be lowercase).
    • after (String, optional): Used to resolve ambiguities by specifying the preceding keyword context.
@Bind(value = "path", after = "FROM")
private String sourcePath;

@Bind(value = "path", after = "TO")
private String destinationPath;

3. @OnClause

A boolean trigger that detects if a specific keyword or optional group was traversed during parsing.

  • Target: Field (boolean) or Method (no-args).
  • Attributes:
    • value (String): The exact keyword to monitor (must be UPPERCASE).
@OnClause("FORCE")
private boolean isForceMode;

@OnClause("RECURSIVE")
public void enableRecursiveMode() {
    this.recursive = true;
}

Note: To maintain high performance and GraalVM compatibility, all bindings are resolved once using MethodHandles during the registration phase.

Next Steps

See how these foundations translate into real-world value in our first Enterprise Use Case: Semantic Firewall for GenAI.