You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @Clonkk -- can you please give an example of what you'd like to do? While we don't (yet) have a way to access the AST directly from Codon, there are ways to get information about types etc. programmatically that, in combination with other features like decorators, can often accommodate "reflection-style" use cases.
Generating multiple functions at compile-time, reducing boiler plate code, implementing templates (code injection) are typical use-case.
Always practical to have on hand but I don't have an actual need for it.
Writing interpreters
Validating and interpreting AST at run-time.
Mapping some external AST onto Codon AST and check the Codon AST is correct or extract an error message.
Codon AST can generate LLVM IR. GraalVM IR + LLI can interpret it; this would make it possible to extend Codon to be both a JIT language and a statically compiled language.
Alternative to above use-case
Since Codon is largely inspired by Python, a typed Codon implementation of the Python AST module to be able to generate, validate and execute Python AST at Codon run-time would work just as well (would probably be slower and much more limiter).
The end goal being able to validate and execute a JIT compiled expression in a statically compiled binary
Is there a way to build AST directly from Codon and resolve it at compile time (essentially metaprogramming / macros) ?
The text was updated successfully, but these errors were encountered: