A modern scripting language running on the JVM
Kotlin-inspired syntax · Seamless Java interop · Async/await · TypeScript-friendly
Features • Quick Start • Examples • Documentation • Architecture
Kotlin-inspired syntax that's concise, expressive, and easy to learn.
val name = "Nova"
var count = 0
fun greet(who: String): String {
return "Hello, $who!"
}
class Point(val x: Int, val y: Int) {
fun distance(): Double = sqrt(x * x + y * y)
}
Built-in asynchronous programming with async/await.
val result = async {
// concurrent computation
heavyComputation()
}
println(await result)
Seamlessly call Java classes and implement Java interfaces.
import java java.util.ArrayList
import java java.lang.Runnable
val list = ArrayList<String>()
list.add("Hello")
val runner = object : Runnable {
fun run() {
println("Running from Nova!")
}
}
- Classes, interfaces, enums, and objects
- Generic types with reified type parameters
- Extension functions
- Nullable types with safe operators (
?.,?:,!!)
Comprehensive stdlib with collections, I/O, JSON, HTTP, and more.
val numbers = [1, 2, 3, 4, 5]
val doubled = numbers.map { it * 2 }
val filtered = numbers.filter { it > 2 }
val json = parseJson("{\"name\": \"Nova\"}")
println(json["name"])
- REPL: Interactive shell for experimentation
- Script: Execute
.novafiles directly - Embedded: Use as a library in Java/Kotlin applications
- JSR-223: Standard scripting engine integration
- JDK 8 or higher
- Gradle 7.x (or use the included wrapper)
./gradlew build./gradlew :nova-cli:run./gradlew :nova-cli:run --args="path/to/script.nova"val PI = 3.14159
var counter = 0
fun factorial(n: Int): Int {
if (n <= 1) return 1
return n * factorial(n - 1)
}
println(factorial(5)) // 120
// If expression
val result = if (x > 0) "positive" else "non-positive"
// When expression (pattern matching)
fun describe(n: Int): String = when (n) {
0 -> "zero"
1, 2 -> "small"
in 3..10 -> "medium"
else -> "large"
}
// For loop with range
for (i in 1..10) {
println(i)
}
// List literal
val items = [1, 2, 3, 4, 5]
// Map literal
val person = #{"name": "Alice", "age": 30}
// Set literal
val unique = #{1, 2, 3}
// Higher-order functions
val squared = items.map { it * it }
val evens = items.filter { it % 2 == 0 }
val sum = items.reduce { a, b -> a + b }
class User(val name: String, var age: Int) {
fun greet(): String = "Hi, I'm $name"
}
val user = User("Alice", 25)
println(user.greet())
// Singleton object
object Database {
fun connect() { println("Connected") }
}
Database.connect()
enum Color {
RED, GREEN, BLUE
}
fun paint(color: Color) {
when (color) {
Color.RED -> println("Painting red")
else -> println("Painting other")
}
}
fun String.shout(): String = this.toUpperCase() + "!"
val msg = "hello"
println(msg.shout()) // HELLO!
val name: String? = maybeNull()
// Safe call
val length = name?.length()
// Elvis operator
val len = name?.length() ?: 0
// Safe index
val first = list?[0]
| Document | Description |
|---|---|
| Syntax Specification | Complete EBNF grammar |
| Usage Guide | How to use NovaLang |
| Java Interop | Java integration guide |
| Standard Library | Built-in modules |
| Reflection API | Runtime type introspection |
| Annotation System | Custom annotations |
NovaLang
├── nova-runtime-api # Core types (NovaValue, NovaClass, etc.)
├── nova-compiler # Lexer, Parser, AST
├── nova-ir # HIR/MIR + Optimization passes
├── nova-runtime # Interpreter + Stdlib
├── nova-cli # Command-line interface
├── nova-script # JSR-223 script engine
├── nova-lsp # Language Server Protocol
└── vscode-nova # VS Code extension
Source Code → Lexer → Parser → AST → HIR → MIR → Interpreter
↓
Optimization Passes
(CSE, DCE, Inlining, etc.)
NovaLang provides a VS Code extension with:
- Syntax highlighting
- Code completion
- Go to definition
- Error diagnostics
Located in vscode-nova/ directory.
NovaLang includes a configurable security sandbox:
# Run with sandbox
nova --sandbox STANDARD script.nova
# Sandbox levels
UNRESTRICTED # No restrictions
STANDARD # Block dangerous operations
STRICT # Minimal permissionsNovaLang is under active development. Current version: 0.1.0-SNAPSHOT
MIT License
Contributions are welcome! Please feel free to submit issues and pull requests.