Also stop building it in `manage.py`` (it is no longer needed for common
Langkit operations). Rename and repurpose `contrib/python_grammar` to
generate+build Libpythonlang, in an attempt to ensure it does not bit
rot.
Add pre-generated sources for Liblktlang in `contrib/lkt/bootstrap` so
that it is possible to build one version of Liblktlang in order to
compile Liblktlang's Lkt sources.
Adjust `manage.py` to build that bootstrap version of Liblktlang
automatically, and add a `manage.py bootstrap` command to genererate
sources for the bootstrap Liblktlang.
`lexer` is a keyword in Lkt, so having a property called `lexer` in Lkt
is an obstacle from the self-hosting of Lkt itself. Rename that property
to avoid this issue.
`val` is a keyword in Lkt, so having a field called `val` in Lkt is an
obstacle from the self-hosting of Lkt itself. Rename that field to avoid
this issue.
Minor refactoring: pass the right verbosity level to CompileCtx.__init__
constructor instead of patching it after the instance has been created
(cleaner).
Replace the messy collection of arguments for CompileCtx.__init__ and
CompileCtx.create_all_passes with better organized dataclasses in the
new langkit.config module. Update the codebase to use these data
structures.
Emit a group for the f_or_expr field only if that field is actually
present, so that we add a "line" only when the "else" keyword is
present. Before this change, that "line" document used to expand to a
hardline because of line length, which Langkit cannot anticipate, so
trivia propagation inserted another line break.
As a nice side effect, the "else" clause is on its own line if its expr
breaks the group (subjectively more readable).
To have the following structure:
class BaseCallExpr : Expr
class LogicCallExpr : CallExpr
class CallExpr : BaseCallExpr
class LogicPredicate : LogicCallExpr
class LogicPropagateCall : LogicCallExpr
This will allow easier unparsing, and easier typing
Replace ManageScript.extra_code_emission_passes property by a
plugin_passes CompileCtx constructor argument to unify plugin passes
that come from the language specification and from the manage script
command line.
Whether unparsers are generated or not has implications on legality
checks for the grammar, so it makes sense for this to be a property of
the grammar itself: introduce an Lkt annotation as well as a
langkit.parsers.Grammar argument for it, and remove the corresponding
CompileCtx argument.
Also rename "generate_unparser" to "generate_unparsers" for consistency
across the codebase.
Let manage.py scripts give the set of extra mains (instead of computing
the whole set), and delay the computation of all mains to the emit step:
this needs to know if unparsers are enabled.
Future work will introduce a grammar annotation to enable unparsers, so
computing the set of mains will be possible only once the grammar has
been lowered.