-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f828271
commit 5dd8db7
Showing
8 changed files
with
75 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
Gradle plugin to generate Kotlin classes from LionWeb languages. | ||
Depends on lionweb-gen. | ||
This plugin introduce support for LIonWeb in Kolasu projects. | ||
|
||
It permits to: | ||
* Generate Kolasu AST classes froma LIonWeb language definition. This is useful when using a language defined by a LIonweb compatible tool different from Kolasu | ||
* Generate a LIonWeb language definition from Kolasu AST classes. This is useful to make a language defined in Kolasu available to other LIonWeb compatible tools. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Logic to generate Kotlin classes from LionWeb languages. | ||
Logic to generate Kolasu AST classes from LionWeb languages. |
This file contains 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
This file contains 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
This file contains 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
24 changes: 0 additions & 24 deletions
24
lionweb-gen/src/main/kotlin/com/strumenta/kolasu/lionweb/LanguageExporter.kt
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
This is a ksp processor (i.e., a lightweight compiler plugin) that find all AST classes and generate the Kotlin code | ||
for the corresponding Language definition. | ||
|
||
For example, it could generate something like this: | ||
|
||
``` | ||
package com.strumenta.math | ||
import com.strumenta.kolasu.lionweb.LanguageGeneratorCommand | ||
import com.strumenta.kolasu.lionweb.KolasuLanguage | ||
import com.strumenta.kolasu.lionweb.LionWebLanguageExporter | ||
import io.lionweb.lioncore.java.language.Language | ||
val kLanguage = KolasuLanguage("com.strumenta.math").apply { | ||
addClass(Expression::class) | ||
addClass(BinaryExpression::class) | ||
addClass(SumExpression::class) | ||
addClass(SubExpression::class) | ||
addClass(IntLiteralExpr::class) | ||
} | ||
val lwLanguage: Language by lazy { | ||
val importer = LionWebLanguageExporter() | ||
importer.export(kLanguage) | ||
} | ||
fun main(args: Array<String>) { | ||
LanguageGeneratorCommand(lwLanguage).main(args) | ||
} | ||
``` |