How to create a Literal for something that isn't defined yet in your language? Follow
I have a language "mylanguage" with a concept called "Class".
I have a solution along side that language which has a module for that language called [mylanguage].core. In that module I define a Class called "Sequence".
I have a SequenceLiteral defined in mylanguage.
The problem is when it comes time to define the typesystem inference aspect for SequenceLiteral I need to reference the definition of Sequence which isn't accessible from the Language.
Should I not be defining these core Classes in a module separate from the language?
Is there a way to do a circular reference and have the language depend on the core module (I tried and wasn't successful)?
Other?
I have a solution along side that language which has a module for that language called [mylanguage].core. In that module I define a Class called "Sequence".
I have a SequenceLiteral defined in mylanguage.
The problem is when it comes time to define the typesystem inference aspect for SequenceLiteral I need to reference the definition of Sequence which isn't accessible from the Language.
Should I not be defining these core Classes in a module separate from the language?
Is there a way to do a circular reference and have the language depend on the core module (I tried and wasn't successful)?
Other?
Please sign in to leave a comment.
If you will have a look at ClassifierType, you ll see that it has a reference to a Classifier, which is used in the typesystem to determine the concrete type.
When it is a variable part which you need to change for each project, then it should be in the solution.
I don't mind at all putting it in my language. I have a few instances of Language concepts that should probably go in the Language. I'm mainly not sure where it should go in the organization of the thing. I finally realized I can put instances of my language elements in any of the aspects, but I'm not really sure where they should go? maybe under runtime?
I would create a new concept that extends the existing one and use the constructor(or nodefactory) to set all the values. Dont know if this could be a solution to you.
I would create a new concept extending e.g. ClassConcept. Then you can describe your concept using the constructor (this.name = "...") and override the editor.
But actually I'm not really sure what you want to do and if this is the best solution.
If it is just Java. You could also write your java-classes externally and make the jar file available to your language and model.
I just want to make a special literal for a specific instance of one of my concepts (an instance of Class called Sequence) that I know will be in the "core library" for my language. It's important to me that other than having a special literal it's treated just like any other Class. The only problem I have is that in the type inference rule for the literal I need to be able to reference the specific instance of my concept in order to say that's the type. I was following the convention that seems to be set elsewhere and providing my core library in a Solution that depends on my language, but then I can't reference things in my core library from w/in my language.
I think I just need to not put my core library in a separate solution and include it in my Language, but I'm just not sure the best spot to put it w/in the language?
So I was confused because you said Class and I was then thinking about BaseLang.
So this are the opportunity I see:
1. This seems like lying, and I imagine it would add special cases to everywhere that wants to deal with instances of Classes.
2. huh, interesting idea, hadn't thought of it, seems pretty ugly though...
3. Yeah this is what I was thinking of trying and wasn't sure where it should go (stubs? runtime? structure?) I'll just try throwing it in structure and see what happens.
Thanks!