Skip to content

imp-language/imp

Repository files navigation

Imp (README TODO)

Imp is a statically typed and compiled scripting language with the goal of increasing programmer confidence.

Note that this project is under development and functionality can be expected to change rapidly. I'm blogging my progress here.

Example

func testUnion(param int | float[] | int[]) {
    match param as id {
        int -> {
            log(id)
            log("int")
        }
        int[] -> {
            log(id)
            log("int[]")
        }
        // Comment this case out for a MatchCoverage error
        float[] -> {
            log(id)
            log("float[]")
        }
    }
}

testUnion(4)
testUnion([4,3,2,1])
testUnion([4.0])

About

Goals

  • Fast Iteration - support rapid iteration through quick compilation and feedback
  • Familiar Syntax - a C-style syntax with curly brackets, no semicolons
  • Scripting Language Characteristics - execution begins at the first statement of the entry file
  • Statically Typed - catch errors at compile-time
  • Write Less Code - the syntax should be succinct and readable
  • Module System - import what you need from other files in the project

Roadmap

  • Grammars
  • Parser (custom Pratt parser)
  • AST
  • Type inference
    • Variable assignments from literals
    • Variable assignments from expressions
  • JVM Codegen
  • Core
    • For-each loop
    • While loop
    • Control flow
    • Structs
    • Functions
    • Union types
    • Generics
    • Pattern matching
    • Enums
  • First-class functions
    • Closures
    • Storing functions in a variable
  • Event loop
  • Debugger
  • Incremental compilation
  • REPL

Usage

Windows

imp.bat <filename>

Unix

chmod u+x imp # the first time only
./imp <filename>

Notes

To run the packaged Imp compiler JAR:

# in the root directory
java --enable-preview -jar target/imp-0.1.jar sample/main.imp

To see a CLOC visualization, https://codeflower.la/?name=imp&owner=mh15&branch=main.

About

Imp is a statically typed and compiled scripting language with the goal of increasing programmer confidence.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages