Skip to content

Mackenzie-High/autumn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Autumn Programming Language

Autumn is a multi-paradigm general-purpose programming language for the JVM.

Quick Links:

Notable Features:

History

The development of Autumn started as a personal project of Mackenzie High in the Spring of 2010.

Download

mackenzie@caprica: cd /tmp
mackenzie@caprica: wget https://github.com/Mackenzie-High/autumn/releases/download/v2_0/autumn.zip
mackenzie@caprica: sha256sum autumn.zip
5a4063f2887e91b114b98c17b408e190183449d3ae0787e09ae33a1e59cf1231  autumn.zip
mackenzie@caprica: unzip autumn.zip
mackenzie@caprica: cd autumn/
mackenzie@caprica: alias autumn='java -jar /tmp/autumn/autumn-2.0.jar'
mackenzie@caprica: autumn version
autumn:2.0:20250527.082723

The alias is created for use in the following examples.

Hello World on Linux

Programs written in Autumn can be compiled, interpreted, or embedded.

Hello World - Compiled

Step: Create a project.

mackenzie@caprica: autumn create example
Current Directory = /home/mackenzie/Downloads
Project Name = example
mackenzie@caprica: 
mackenzie@caprica: cd example/

Step: Create or edit the src/Main.leaf program entrypoint.

module Main in program;

@Start
defun main (args : String[]) : void
{
    F::println ("Hello World!");
}

Step: Compile the project to generate the program.jar file.

mackenzie@caprica: autumn compile

Step: Add Autumn ands its dependencies to the CLASSPATH.

mackenzie@caprica: export CLASSPATH="${CLASSPATH}:$(find /tmp/autumn -type f -exec echo -n {}: \;)"

Step: Add the compiled program to the CLASSPATH.

mackenzie@caprica: export CLASSPATH="${CLASSPATH}:program.jar"

Step: Run the compiled program.

mackenzie@caprica: java program.Main
Hello World!

Hello World - Interpreted

Autumn interprets a program by compiling and then dynamically loading the generated bytecode at startup.

Step: Create a project.

mackenzie@caprica: autumn create example
Current Directory = /home/mackenzie/Downloads
Project Name = example
mackenzie@caprica: 
mackenzie@caprica: cd example/

Step: Create or edit the src/Main.leaf program entrypoint.

module Main in program;

@Start
defun main (args : String[]) : void
{
    F::println ("Hello World!");
}

Step: Run the program.

mackenzie@caprica: java -jar /tmp/autumn/autumn-2.0.jar run
Hello World!

Hello World - Embedded

Step: Create a Maven project and add Autumn as a dependency.

<dependency>
    <groupId>com.mackenziehigh</groupId>
    <artifactId>autumn</artifactId>
    <version>2.0</version>
</dependency>

Step: Embed Autumn in the main Java program.

import autumn.lang.compiler.Autumn;
import autumn.lang.compiler.AutumnParser;
import autumn.lang.compiler.errors.BasicErrorReporter;
import java.io.File;

public final class Main
{
    public static void main (final String[] args) throws Throwable
    {
        // This is the string of Autumn source code that 
        // will be dynamically compiled and executed.
        final String code = """
module Main in program;

@Start
defun main (args : String[]) : void
{
    F::println("Hello World from inside an Autumn script!");
}
                            """;

        // This object will be write any compilation errors to stdout.
        final BasicErrorReporter reporter = new BasicErrorReporter(System.out);

        // Create a parser that can parse Autumn source-code.
        final AutumnParser parser = new AutumnParser(reporter);

        // This file object does *not* refer to a real file.
        // The parser requires a file object for reporting syntax errors.
        final File fake = new File("<script>");

        // Parse the script in order to obtain an Abstract-Syntax-Tree.
        final autumn.lang.compiler.ast.nodes.Module tree = parser.parse(code, fake);

        // This object will control compilation and execution.
        final Autumn autumn = new Autumn();
        autumn.setErrorReporter(reporter);
        autumn.src(tree);

        // Compile and execute the script that is written in Autumn.
        autumn.run(new String[0]);
    }
}

Language Specification

Dependencies

About

Autumn is a multi-paradigm, compiled, and statically-typed programming language for the JVM.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages