Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 1.37 KB

File metadata and controls

78 lines (53 loc) · 1.37 KB

Getting Started with Nimble

Nimble is a register‑based bytecode language with optional type annotations and a small but pragmatic standard library. JIT scaffolding exists but is not yet wired into execution.

Installation

Build from source using Cargo:

cargo build --release

Your First Program

Create hello.nmb:

fn main():
    out("Hello, Nimble!")

main()

Run it:

nimble run hello.nmb

Tooling Workflow

  • nimble run <file> – compiles and runs a script from the current directory, automatically checking types before executing.
  • nimble check <file> – performs parsing and inference only, but still prints the same colorful diagnostics the runtime emits.
  • nimble repl – drops into the REPL with :globals, diagnostics, and the runtime hook enabled so you can experiment safely.

Browse examples/README.md for the curated basic and standard-library samples referenced from the docs tree.

Variables and Types

x = 10
name = "Soumalya"
pi float = 3.14
active bool = true

Functions

fn add(a int, b int) -> int:
    return a + b

fn square(x int) -> int = x * x

User Input

name = in("Enter your name: ")
out("Hello {name}!")

Range Loops

for i in 0..10:
    out(i)

for i in 0..10 step 2:
    out(i)

Modules

load math
out(math.add(2, 3))