Skip to content

Commit

Permalink
Add JVM backend
Browse files Browse the repository at this point in the history
  • Loading branch information
mmhelloworld committed Jul 20, 2021
1 parent 752c169 commit 2a20a23
Show file tree
Hide file tree
Showing 127 changed files with 11,767 additions and 53 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Expand Up @@ -11,6 +11,9 @@ idris2docs_venv
# Editor/IDE Related
.\#* # Emacs swap file
*~ # Vim swap file
.idea
*.iml

# VS Code
.vscode/*

Expand Down Expand Up @@ -38,3 +41,12 @@ idris2docs_venv
/bootstrap/idris2-boot.rkt

/custom.mk

*.class
*.jar
*-pom.xml
target
output
build
classes/**
*-classes/**
6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -8,9 +8,9 @@ NAME = idris2
TARGETDIR = build/exec
TARGET = ${TARGETDIR}/${NAME}

MAJOR=0
MINOR=2
PATCH=1
MAJOR := $(shell mvn -q -Dexec.executable="echo" -Dexec.args='$${idris2.major.version}' --non-recursive exec:exec)
MINOR := $(shell mvn -q -Dexec.executable="echo" -Dexec.args='$${idris2.minor.version}' --non-recursive exec:exec)
PATCH := $(shell mvn -q -Dexec.executable="echo" -Dexec.args='$${idris2.patch.version}' --non-recursive exec:exec)


GIT_SHA1=
Expand Down
98 changes: 98 additions & 0 deletions compiler/pom.xml
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.github.mmhelloworld.idris2</groupId>
<artifactId>idris2</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>compiler</artifactId>
<name>Idris 2 JVM Compiler</name>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<skipIdrisCompile>false</skipIdrisCompile>
<skipIdrisInstallLibrary>false</skipIdrisInstallLibrary>
<skipIdrisClean>false</skipIdrisClean>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>idris-compile</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipIdrisCompile}</skip>
<executable>make</executable>
<workingDirectory>${project.parent.basedir}</workingDirectory>
<arguments>
<argument>all</argument>
<argument>IDRIS2_BOOT=idris2boot</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>idris-install-libs</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipIdrisInstallLibrary}</skip>
<executable>make</executable>
<workingDirectory>${project.parent.basedir}</workingDirectory>
<arguments>
<argument>install</argument>
<argument>IDRIS2_BOOT=idris2boot</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>idris-clean</id>
<phase>clean</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipIdrisClean}</skip>
<executable>make</executable>
<workingDirectory>${project.parent.basedir}</workingDirectory>
<arguments>
<argument>clean</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-idris2-classes</id>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy file="../build/exec/idris2_app/idris2.jar"
tofile="${project.build.directory}/compiler-${project.version}.jar"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
15 changes: 15 additions & 0 deletions idris2api.ipkg
Expand Up @@ -26,6 +26,21 @@ modules =
Compiler.Scheme.Gambit,
Compiler.Scheme.Common,

Compiler.Jvm.Tuples,
Compiler.Jvm.Asm,
Compiler.Jvm.Codegen,
Compiler.Jvm.ExtPrim,
Compiler.Jvm.FunctionTree,
Compiler.Jvm.Optimizer,
Compiler.Jvm.InferredType,
Compiler.Jvm.Jname,
Compiler.Jvm.Jvar,
Compiler.Jvm.MockAsm,
Compiler.Jvm.Variable,
Compiler.Jvm.ShowUtil,
Compiler.Jvm.Tree,
Compiler.Jvm.Foreign,

Core.AutoSearch,
Core.Binary,
Core.CaseBuilder,
Expand Down
155 changes: 155 additions & 0 deletions jvm-assembler/pom.xml
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.github.mmhelloworld.idris2</groupId>
<artifactId>idris2</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>jvm-assembler</artifactId>
<name>Idris 2 JVM Assembler</name>

<properties>
<idris.tests/>
<skipTests>false</skipTests>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-idris2-libs</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/idris2/.idris2/idris2-${idris2.major.version}.${idris2.minor.version}.${idris2.patch.version}
</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>
${project.parent.basedir}/compiler/target/.idris2/idris2-${idris2.major.version}.${idris2.minor.version}.${idris2.patch.version}
</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<configuration>
<extraJvmArguments>-Xss8m -Xms2g -Xmx3g</extraJvmArguments>
<repositoryName>lib</repositoryName>
<repositoryLayout>flat</repositoryLayout>
<assembleDirectory>${project.build.directory}/idris2</assembleDirectory>
<programs>
<program>
<mainClass>idris2.Main</mainClass>
<id>idris2</id>
</program>
</programs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/bin.xml</descriptor>
</descriptors>
<finalName>idris2</finalName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>idris-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<executable>make</executable>
<workingDirectory>${project.parent.basedir}</workingDirectory>
<arguments>
<argument>test</argument>
<argument>${idris.tests}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>io.github.mmhelloworld.idris2</groupId>
<artifactId>compiler</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.github.mmhelloworld.idris2</groupId>
<artifactId>runtime</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
14 changes: 14 additions & 0 deletions jvm-assembler/src/assembly/bin.xml
@@ -0,0 +1,14 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/idris2</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
@@ -0,0 +1,23 @@
package io.github.mmhelloworld.idris2.jvmassembler;

import java.util.List;

public class Annotation {
private final String name;
private final List<AnnotationProperty> properties;

public Annotation(final String name,
final List<AnnotationProperty> properties) {
this.name = name;
this.properties = properties;
}

public String getName() {
return name;
}

public List<AnnotationProperty> getProperties() {
return properties;
}
}

@@ -0,0 +1,20 @@
package io.github.mmhelloworld.idris2.jvmassembler;

public class AnnotationProperty {
private final String name;
private final AnnotationValue value;

public AnnotationProperty(final String name,
final AnnotationValue value) {
this.name = name;
this.value = value;
}

public AnnotationValue getValue() {
return value;
}

public String getName() {
return name;
}
}

0 comments on commit 2a20a23

Please sign in to comment.