diff --git a/Lang/build.gradle b/Lang/build.gradle
index 15afb54..30a9ac2 100644
--- a/Lang/build.gradle
+++ b/Lang/build.gradle
@@ -21,7 +21,7 @@
plugins {
id 'maven-publish'
- id 'org.asciidoctor.jvm.convert' version '3.1.0'
+ //id 'org.asciidoctor.jvm.convert' version '3.1.0'
}
apply plugin: 'java'
@@ -119,9 +119,9 @@ publishing {
}
}
-asciidoctor {
+/*asciidoctor {
sourceDir 'src/doc/asciidoc'
-}
+}*/
clean {
delete 'build'
diff --git a/Lang/src/main/java/chipmunk/compiler/Layout.java b/Lang/src/main/java/chipmunk/compiler/Layout.java
new file mode 100644
index 0000000..2b5564f
--- /dev/null
+++ b/Lang/src/main/java/chipmunk/compiler/Layout.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2024 MyWorld, LLC
+ * All rights reserved.
+ *
+ * This file is part of Chipmunk.
+ *
+ * Chipmunk is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chipmunk is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Chipmunk. If not, see .
+ */
+
+package chipmunk.compiler;
+
+import chipmunk.compiler.types.ObjectType;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+public class Layout {
+
+ public static final int WORD_SIZE_STANDARD = 1;
+ public static final int WORD_SIZE_DOUBLE = 2;
+
+ public record Field(String name, ObjectType type, int size){}
+
+ protected final String name;
+ protected final ObjectType type;
+ protected final List fields;
+
+ public Layout(String name, ObjectType type){
+ this.name = name;
+ this.type = type;
+ fields = new ArrayList<>();
+ }
+
+ public boolean hasField(String name){
+ return fields.stream()
+ .anyMatch(f -> f.name().equals(name));
+ }
+
+ public Layout addField(Field field){
+ if(hasField(field.name())){
+ throw new IllegalArgumentException("Field " + field.name() + " already exists for layout " + name);
+ }
+ fields.add(field);
+ return this;
+ }
+
+ public List getFields(){
+ return fields;
+ }
+
+ public Optional getField(String name){
+ return fields.stream()
+ .filter(field -> field.name().equals(name))
+ .findFirst();
+ }
+
+}
diff --git a/Lang/src/main/java/chipmunk/compiler/ast/transforms/TypeBuilderVisitor.java b/Lang/src/main/java/chipmunk/compiler/ast/transforms/TypeBuilderVisitor.java
new file mode 100644
index 0000000..623d612
--- /dev/null
+++ b/Lang/src/main/java/chipmunk/compiler/ast/transforms/TypeBuilderVisitor.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2024 MyWorld, LLC
+ * All rights reserved.
+ *
+ * This file is part of Chipmunk.
+ *
+ * Chipmunk is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chipmunk is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Chipmunk. If not, see .
+ */
+
+package chipmunk.compiler.ast.transforms;
+
+import chipmunk.compiler.ast.AstNode;
+import chipmunk.compiler.ast.AstVisitor;
+import chipmunk.compiler.lexer.TokenType;
+import chipmunk.compiler.types.ObjectType;
+
+public class TypeBuilderVisitor implements AstVisitor {
+
+ @Override
+ public void visit(AstNode node) {
+ node.visitChildren(this);
+
+ switch (node.getNodeType()){
+ case LITERAL -> {
+ if(node.getToken().type() == TokenType.INTLITERAL){
+ node.setResultType(ObjectType.INT);
+ }else if(node.getToken().type() == TokenType.FLOATLITERAL){
+ node.setResultType(ObjectType.FLOAT);
+ }
+ }
+ case OPERATOR -> {
+ if(node.getToken().type() == TokenType.PLUS){
+ node.setResultType(ObjectType.INT); // TODO - match off of children
+ }
+ }
+ }
+ }
+}
diff --git a/Lang/src/main/java/chipmunk/compiler/types/ObjectType.java b/Lang/src/main/java/chipmunk/compiler/types/ObjectType.java
index fb07d62..aa72e6f 100644
--- a/Lang/src/main/java/chipmunk/compiler/types/ObjectType.java
+++ b/Lang/src/main/java/chipmunk/compiler/types/ObjectType.java
@@ -25,6 +25,10 @@
public record ObjectType(String name, boolean isPrimitive, boolean isType, List superTypes) {
public static final ObjectType ANY = new ObjectType("Any", false, true);
+ public static final ObjectType INT = new ObjectType("Int", true, false);
+ public static final ObjectType FLOAT = new ObjectType("Float", true, false);
+ public static final ObjectType LONG = new ObjectType("Long", true, false);
+ public static final ObjectType DOUBLE = new ObjectType("Double", true, false);
public ObjectType(String name, boolean isPrimitive, boolean isType){
this(name, isPrimitive, isType, List.of());