Created
April 18, 2025 13:05
-
-
Save Descalon/497b738d762353c7b6809641d095ea09 to your computer and use it in GitHub Desktop.
Karser example Calculator Language
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
language("CalculatorLang") { | |
val inputFieldConcept = concept("InputField") { | |
implements(INamedConcept) | |
editor { | |
collection(CollectionLayout.INDENT){ | |
stringConstant("Input") | |
property("name") | |
} | |
} | |
} | |
val inputFieldRefConcept = concept("InputFieldReference") { | |
extends(BaseLanguage.Expression) | |
ref("field", inputFieldConcept) | |
editor { | |
ref("field", "name") | |
} | |
} | |
val outputFieldConcept = concept("OutputField"){ | |
implements(INamedConcept) | |
child("expression", BaseLanguage.Expression) | |
editor { | |
collection(CollectionLayout.INDENT){ | |
stringConstant("Output") | |
child("expression") | |
} | |
} | |
} | |
concept("Calculator") { | |
implements(INamedConcept) | |
isRoot() | |
child("input", inputFieldConcept) | |
child("output", outputFieldConcept) { | |
isOptional = true | |
} | |
editor { | |
collection(CollectionLayout.INDENT){ | |
stringConstant("Calculator") | |
property("name") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment