Repository navigation
LanguageFactory: declaration order, concept relations, elements of other languages - #15
Merged
Merged
Conversation
- Build elements, and the features of each classifier, in declaration order instead of grouping them by kind. - Concepts accept extends, implements, abstract and partition (extends on a concept factory used to be ignored); annotations accept extends and implements. - Types, extended and implemented classifiers can be elements of other languages: factories are resolved to the elements built from them instead of being looked up by name in the language being built. - LanguageFactory accepts the dependencies of the language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the order within each kind of feature matters, not the order across kinds: go back to one list per kind, each kept in declaration order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LanguageFactorymakes language definitions much shorter, but it couldn't express several things real languages need. This PR fills those gaps, driven by porting the starlasu-specs languages to the factory.Changes
Declaration order.
build()used to create all primitive types, then all enumerations, then all classifiers. Now the elements of the language are created in the order they are declared. Within a classifier, properties, references and containments are each created in declaration order.Concept and annotation relations.
concept(...)acceptsextends,implements,abstractandpartition.annotation(...)acceptsextendsandimplements.set_extendson a concept factory used to be silently ignored; it now works.tests/generation/test_language_generation.pywas expecting the output of that bug, so its expected code now includesmy_other_concept.set_extended_concept(my_concept).Elements of other languages. Types (of properties, references, containments), extended/implemented classifiers and
annotatesused to be looked up by name in the language being built. Socontainment("issues", other_language.get_concept_by_name("Issue"))orcontainment("ast", LionCoreBuiltins.get_node())failed. Now factories are resolved through a map from factory to built element, and elements that are already built are used as they are. A factory belonging to a differentLanguageFactoryraises aValueErrorexplaining to pass the built element instead.Dependencies.
LanguageFactory(..., dependencies=[...])adds them to the built language.Internals.
ClassifierFactory.populate()receives the map of built elements. Nothing outsidedefinition.pycalls it.