summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hobgoblin/hobgoblin.json524
-rw-r--r--hobgoblin/src/hobgoblin/untyped.hob67
-rw-r--r--makefile5
3 files changed, 96 insertions, 0 deletions
diff --git a/hobgoblin/hobgoblin.json5 b/hobgoblin/hobgoblin.json5
new file mode 100644
index 0000000..139c070
--- /dev/null
+++ b/hobgoblin/hobgoblin.json5
@@ -0,0 +1,24 @@
+{
+ outputs: [
+ {
+ generator: "java-types",
+ path: "../src/main/java",
+ packageName: "org.zwobble.hobgoblin.compiler.ast.untyped",
+ nativeTypes: [
+ {
+ // TODO: should be hobgoblin/untyped.Source ?
+ hobgoblin: "hobgoblin.untyped.Source",
+ java: "org.zwobble.hobgoblin.compiler.sources.Source",
+ },
+ {
+ hobgoblin: "hobgoblin.untyped.NamespaceName",
+ java: "org.zwobble.hobgoblin.compiler.types.NamespaceName",
+ },
+ {
+ hobgoblin: "hobgoblin.untyped.DocComment",
+ java: "org.zwobble.hobgoblin.compiler.ast.DocComment",
+ }
+ ],
+ },
+ ],
+}
diff --git a/hobgoblin/src/hobgoblin/untyped.hob b/hobgoblin/src/hobgoblin/untyped.hob
new file mode 100644
index 0000000..31ba4f2
--- /dev/null
+++ b/hobgoblin/src/hobgoblin/untyped.hob
@@ -0,0 +1,67 @@
+native Source {
+}
+
+native NamespaceName {
+}
+
+native DocComment {
+}
+
+struct UntypedNamespaceNode {
+ field namespaceName: NamespaceName;
+ field body: List[UntypedNamespaceStatementNode];
+ field source: Source;
+}
+
+sum UntypedNamespaceStatementNode {
+ variant UntypedNativeTypeDefinitionNode;
+ variant UntypedStructDefinitionNode;
+ variant UntypedSumDefinitionNode;
+}
+
+struct UntypedNativeTypeDefinitionNode {
+ field name: String;
+ field docComment: DocComment;
+ field source: Source;
+}
+
+struct UntypedStructDefinitionNode {
+ field name: String;
+ field fields: List[UntypedStructFieldDefinitionNode];
+ field docComment: DocComment;
+ field source: Source;
+}
+
+struct UntypedStructFieldDefinitionNode {
+ field name: String;
+ field type: UntypedTypeLevelExpressionNode;
+ field source: Source;
+}
+
+struct UntypedSumDefinitionNode {
+ field name: String;
+ field variants: List[UntypedSumVariantDefinitionNode];
+ field docComment: DocComment;
+ field source: Source;
+}
+
+struct UntypedSumVariantDefinitionNode {
+ field type: UntypedTypeLevelExpressionNode;
+ field source: Source;
+}
+
+sum UntypedTypeLevelExpressionNode {
+ variant UntypedConstructedTypeNode;
+ variant UntypedTypeLevelReferenceNode;
+}
+
+struct UntypedConstructedTypeNode {
+ field receiver: UntypedTypeLevelExpressionNode;
+ field args: List[UntypedTypeLevelExpressionNode];
+ field source: Source;
+}
+
+struct UntypedTypeLevelReferenceNode {
+ field name: String;
+ field source: Source;
+}
diff --git a/makefile b/makefile
index 66b9e08..dcb0884 100644
--- a/makefile
+++ b/makefile
@@ -2,3 +2,8 @@
package:
mvn package -Dmaven.test.skip=true
+
+.PHONY: codegen
+
+codegen: package
+ java -jar target/hobgoblin-0.1.0.jar compile hobgoblin