Skip to main content

An interpreted programming language with JIT compilation

Project description

Juno Programming Language

Juno is an interpreted programming language that improves upon Java's syntax while maintaining the benefits of Java's powerful features. It combines the flexibility of an interpreted language with the performance benefits of Just-In-Time (JIT) compilation.

Key Features

  • Interpreted Language with JIT Compilation: Executes code line-by-line with dynamic optimization of hot code paths
  • Simplified Syntax: Cleaner, more concise code with less boilerplate
  • First-Class Functions: Functions can be passed around like variables
  • Modern Memory Management: Automatic garbage collection with optional unsafe operations
  • Dynamic Features: Hot reloading and reflection capabilities
  • Concurrency & Async Programming: Built-in async/await and lightweight concurrency models
  • Advanced Error Handling: Result types with pattern matching
  • Pattern Matching: Powerful pattern matching for simplified conditional logic
  • Comprehensive Standard Library: Modern collections, I/O utilities, and functional programming tools
  • Runtime Optimizations: Hotspot detection, profile-guided optimization, and caching

Example

// Simple function definition and invocation
func greet(name) {
    Show("Hello, " + name)
}

greet("World")

// Pattern matching example
let message = match(input) {
    case "hello" => "Hi there!"
    case 42 => "The answer to everything!"
    case _ => "Unknown input"
}
Show(message)

// Error handling with result types
let result = try readFile("data.txt")
match result {
    case Success(content) => Show(content)
    case Error(err) => Show("Error reading file: " + err)
}

Getting Started

Installation

You can install Juno using pip:

# Install from PyPI (when available)
pip install juno-lang

# Or install from source
git clone https://github.com/junolang/juno.git
cd juno
pip install -e .

Running Juno Programs

Once installed, you can run Juno programs using the juno command:

# Run a Juno file
juno path/to/your/program.juno

# Start the interactive REPL
juno --repl

# Enable debugging
juno --debug path/to/your/program.juno

# Show version information
juno --version

Writing Your First Juno Program

Create a file named hello.juno with the following content:

// My first Juno program
func main() {
    Show("Hello, Juno!");
}

main();

Then run it with:

juno hello.juno

Language Syntax

Variables

// Variable declaration
let name = "Juno";
var age = 1;  // var can be reassigned

// Constants (by convention, not enforced)
let PI = 3.14159;

Functions

// Named function
func add(a, b) {
    return a + b;
}

// Anonymous function
let multiply = func(a, b) {
    return a * b;
};

// Async function
async func fetchData() {
    // Asynchronous operations
    return "data";
}

Control Flow

// If statement
if (condition) {
    // code
} else if (otherCondition) {
    // code
} else {
    // code
}

// While loop
while (condition) {
    // code
}

// For loop
for (let i = 0; i < 10; i = i + 1) {
    // code
}

Pattern Matching

let result = match(value) {
    case 0 => "Zero"
    case 1 => "One"
    case "hello" => "Greeting"
    case _ => "Default case"
};

Error Handling

// Using result types
let result = try someOperationThatMightFail();
match result {
    case Success(value) => Show("Success: " + value)
    case Error(err) => Show("Error: " + err)
};

// Using try/catch
try {
    // Code that might throw an error
} case Error(e) => {
    // Handle error
} case _ => {
    // Catch all other errors
};

Project Structure

  • juno/ - The main package containing the interpreter
    • __main__.py - Entry point for the interpreter
    • lexer.py - Tokenizes source code
    • parser.py - Parses tokens into an AST
    • ast.py - Defines the Abstract Syntax Tree nodes
    • interpreter.py - Interprets the AST
    • runtime.py - Runtime environment
    • jit.py - Just-In-Time compiler
  • examples/ - Example Juno programs
  • tests/ - Test suite

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

juno_lang-0.1.0.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

juno_lang-0.1.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file juno_lang-0.1.0.tar.gz.

File metadata

  • Download URL: juno_lang-0.1.0.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for juno_lang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d635ecb69f64641362a791454538d7ee628db02baf9f69209a0a9cdd3ce723cd
MD5 573e3fd14523f178805e53f07014e2dc
BLAKE2b-256 e44a4537bead95d7223f666e4c47fa536f1742144a0fd005fcae68ce69612758

See more details on using hashes here.

File details

Details for the file juno_lang-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: juno_lang-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for juno_lang-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5dc5f5c9c595dc812b8dce790be1bb6793a4ea5af2433d6582e12b9d1cf278c
MD5 1d3556147898b3843bad7d86d21ca41e
BLAKE2b-256 25e6a1e98a46f748d8a00e5d809534999e2613600b0286c91418fff6967c6392

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page