Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EQL: fluent API generation #2182

Open
homedirectory opened this issue Feb 12, 2024 · 1 comment
Open

EQL: fluent API generation #2182

homedirectory opened this issue Feb 12, 2024 · 1 comment

Comments

@homedirectory
Copy link
Contributor

homedirectory commented Feb 12, 2024

Description

Possibility of fluent API generation for EQL should be researched.

The following requirements should be consulted when considering a tool capable of fluent API generation:

  1. Accepts grammar in a suitable notation (e.g., Backus-Naur Form).
    1. Supports a broad range of grammars. Should not limit input to LL form. Should implicitly
      rewrite given grammar rules if necesssary (e.g., to eliminate left recursion).
  2. Generates 3 artifacts from a grammar:
    1. Java interfaces that constitute the fluent API.

      1. Ability to insert documentation into generated code (e.g., javadoc on methods).
      2. Ability to arbitrarily parameterise generated interfaces. This allows carrying of
        additional information (in the same way that EQL currently carries the entity type that is passed to select)
    2. A parser that builds an AST for a given chain of called methods.

    3. Java classes that represent the AST corresponing to the grammar.

      This requirement is closely tied to requirement 1.1 as the generated AST will have to be
      transformed into a different form that is required for EQL-specific query transformation.
      Given that EQL will be evolving, the generated AST should be as malleable as the input grammar.

  3. Method calls on the generated API have acceptable compilation times. This will heavily depend on type signatures in generated methods.
  4. Guarantee of correctness of expressions formed by method chains from the generated API. Any fluent API generator in Java should satisfy this property by relying on Java's type system. Therefore, this boils down to making sure that the generated API correctly represents the specified grammar.

Note that 2.2-2.3 can be viewed as extensions to 2.1. That is, having a fluent API generator that
produces the API only and leaves the parsing to the user is enough to be considered on its own.

Expected outcome

Research of possibilities of fluent API generation is conducted. The most suitable tool is chosen if there is one, otherwise it is concluded that fluent API generation is not currently possible.

@homedirectory
Copy link
Contributor Author

homedirectory commented Feb 14, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants