# Alice programming language for .NET

> Writes like Ruby. Runs like C. Bugs don't compile. On .NET.

Alice is an open-source programming language for .NET. You write Ruby-style code: blocks, `case/in`, string interpolation and DSLs. The compiler works out the types for you, stops nil errors and data races before the program runs, and turns your loops into SIMD code that runs on every core without temporary arrays. Every .NET library and NuGet package works as is.

- Homepage: https://alice-lang.org/
- Source: https://github.com/alicelanguage/alice
- Language guide: https://alice-lang.org/documentation/
- Getting started: https://alice-lang.org/documentation/learn/installation/
- Releases: https://github.com/alicelanguage/alice/releases
- Playground (runs Alice in your browser): https://playground.alice-lang.org
- Install: https://alice-lang.org/install/
- Benchmarks with machine and method: https://alice-lang.org/benchmarks/
- Showcase: https://alice-lang.org/showcase/
- Roadmap (1.0 shipped, 1.1 planned): https://alice-lang.org/roadmap/

## Hello, Wonderland

```alice
def greet(name : String) : String
  "Hello, #{name}!"
end

puts greet("Wonderland")
```

Expected output: `Hello, Wonderland!`

## Why Alice

1. Your bugs don't compile: forget a nil check or let two tasks write the same variable (AL0202), and the build stops at that line with the fix in the message. An index past the end of an array is caught on every access. `val` never changes. Mark a function `pure def` or `safe def` and the compiler holds it to that promise.
2. Fast without trying: write the loop like Ruby. `map/select/sum` chains become one SIMD loop with no temporary arrays, independent loop iterations and recursive calls spread across every core with no annotations, and arrays that never leave a function go back to a pool instead of the GC. `par for` makes "runs on all cores" a requirement (AL0209); `gpu for` runs a loop on the GPU. On a 12-thread Core i5 laptop Alice matches or beats C on all five C benchmarks (nbody with `@[Native]`); on the Bend 2 suite it runs 9.0x to 15.6x faster on 32 cores than on one.
3. AI can't break it: write what your code must never do in `RULES.al`. The compiler tries every case in each rule's range (or the whole Int32/Int64 range with `--smt`) and refuses a change that breaks one, with the failing input. `alice prove --check` fails CI; `alice agents --write` tells your coding agent to run it before every commit.
4. Nothing to give up: every .NET library and NuGet package works as is. Generics, async/await, LINQ, spans, ASP.NET, MonoGame, raylib, EF Core, Avalonia. Blocks, `case/in`, interpolation and DSLs read like Ruby, with types checked before the program runs.
5. In progress: Alice Core (SIMD regex and JSON beyond the BCL) and WebAssembly without the .NET runtime. Today `kind = "wasm"` builds browser packages on .NET.
6. Built for agents: `alice guide` prints the language guide; `alice agents --write` adds the Alice rules to `AGENTS.md`.

Benchmarks, with machine, method and checksums: https://alice-lang.org/benchmarks/

## What can you build?

### Web & APIs

Build on ASP.NET Core. Use the .NET libraries you already know, straight from Alice.

Tools: ASP.NET Core, NuGet, System.Text.Json.

```alice
using Microsoft.AspNetCore.Builder
using Microsoft.AspNetCore.Http

record Health(status : String)

builder = WebApplication.CreateBuilder(ARGV)
app = builder.Build()

app.MapGet("/health", -> {
  Results.Ok(Health.new("ok"))
})

app.Run()
```

[Explore the example](https://github.com/alicelanguage/alice/tree/main/examples/web/aspnet)

### Data & compute

Express a pipeline. Alice fuses eligible operations into loops, with vectorization and safe parallelism.

Tools: SIMD, Parallel loops, .NET collections.

```alice
# A pipeline, lowered to a fused loop.
total = (1..1_000_000)
  .map { |i| i.to_i64 * i }
  .select { |x| x % 2 == 0 }
  .sum

puts "total=#{total}"

# Inspect the generated C#:
# alice emit squares.al
```

[Explore the example](https://github.com/alicelanguage/alice/blob/main/README.md)

### Games & graphics

Work with MonoGame and raylib. Bring your game loop, graphics, and a little imagination.

Tools: MonoGame, raylib, Value types.

```alice
using Microsoft.Xna.Framework
using Microsoft.Xna.Framework.Graphics

class HelloGame < Game
  def initialize
    GraphicsDeviceManager.new(self)
    self.Window.Title = "Hello, Wonderland"
  end

  def Draw(time : GameTime)
    GraphicsDevice.Clear(Color.CornflowerBlue)
    super
  end
end

HelloGame.new.Run
```

[Explore the example](https://github.com/alicelanguage/alice/tree/main/samples/BounceGame)

### Little languages

Blocks, yield, and Ruby-style DSLs turn your domain into a language of its own.

Tools: Blocks & yield, Pattern matching, RSpec-style tests.

```alice
# From the Wonderland adventure sample.
World.build do |w|
  w.room "rabbit hole" do |r|
    r.instance_eval do
      describe "A tiny door glows below."
      exit "east", "hall"
      exit "down", "garden"
      item "watch"
    end
  end
end
```

[Explore the example](https://github.com/alicelanguage/alice/tree/main/samples/wonderland)

### GPU loops

Write a gpu for loop. Alice compiles its body to an ILGPU kernel and runs it on the preferred device, or on the CPU accelerator.

Tools: ILGPU, CUDA & OpenCL, Device reductions.

```alice
def saxpy(a : Float32, xs : Array(Float32), ys : Array(Float32))
  gpu for i in 0...xs.size
    ys[i] = a * xs[i] + ys[i]
  end
end

def total(xs : Array(Int64)) : Int64
  t = 0_i64
  gpu for i in 0...xs.size
    t += xs[i] * 2_i64
  end
  t
end
```

[Explore the example](https://github.com/alicelanguage/alice/tree/main/examples/gpu/ilgpu)

### C interop

Pass UTF-8 strings, fill out-parameters and hand C a callback written as a lambda. No marshalling stubs and no delegates.

Tools: FFI, UTF-8 strings, C callbacks.

```alice
@[Link("libc.so.6")]
lib LibC
  fun strlen(s : String) : UInt64                  # UTF-8 on a stack buffer, no allocation
  fun qsort(base : Array(Int32), n : UInt64, size : UInt64, cmp : Callback(Pointer(Int32), Pointer(Int32), Int32)) : Void
end

puts "strlen: #{LibC.strlen("héllo")}"            # 6 bytes in UTF-8
xs = [42, 7, 19, 3, 25]
LibC.qsort(xs, 5_u64, 4_u64, ->(a : Pointer(Int32), b : Pointer(Int32)) { a[0] <=> b[0] })
puts "sorted by C: #{xs.join(", ")}"
```

[Explore the example](https://github.com/alicelanguage/alice/tree/main/examples/interop)

### Iterators & events

Write iterators with yield, pass methods as values and declare delegates. C# callers see the same API shapes.

Tools: Iterators, Delegates, Method references.

```alice
delegate Transform(x : Int32) : Int32

def triple(x : Int32) : Int32
  x * 3
end

def apply(t : Transform, x : Int32) : Int32
  t.Invoke(x)
end

def evens(limit : Int32) : IEnumerable(Int32)   # lazy: yield return
  i = 0
  while true
    return if i > limit
    yield i
    i += 2
  end
end

puts evens(10).ToList().join(",")
puts apply(->triple, 5)
puts [1, 2, 3].map(->triple).join(",")
```

[Explore the example](https://github.com/alicelanguage/alice/tree/main/examples/dotnet)

### Databases

Entity Framework Core from Alice: a DbContext subclass, SaveChanges, and lambdas that EF translates to SQL.

Tools: Entity Framework Core, SQLite, LINQ.

```alice
using Microsoft.EntityFrameworkCore

class Blog
  property id : Int32 = 0
  property name : String = ""
  property rating : Int32 = 0
end

class BlogDb < DbContext
  property blogs : DbSet(Blog)                     # EF fills DbSet properties
  def OnConfiguring(options : DbContextOptionsBuilder)
    options.UseSqlite("Data Source=#{System.IO.Path.Combine(System.IO.Path.GetTempPath(), "alice-blogs.db")}")
  end
end

using db = BlogDb.new
  db.Database.EnsureCreated
  db.blogs.Add(Blog.new.tap { |b| b.name = "alice"; b.rating = 5 })
  db.blogs.Add(Blog.new.tap { |b| b.name = "bob"; b.rating = 2 })
  db.SaveChanges
  good = db.blogs.Where(->(b : Blog) { b.rating > 3 }).OrderBy(->(b : Blog) { b.name }).Select(->(b : Blog) { b.name }).ToList()
  puts "rated above 3: #{good.join(", ")}"
end
```

[Explore the example](https://github.com/alicelanguage/alice/tree/main/examples/data/efcore)

## Made with Alice

- [Parallel ray tracer](https://github.com/alicelanguage/alice/tree/main/samples/raytracer): reflective spheres, lighting, and shadows.
- [Mandelbrot explorer](https://github.com/alicelanguage/alice/tree/main/samples/fractal): a parallel fractal zoom.
- [Celeste Classic](https://github.com/alicelanguage/alice/tree/main/samples/celeste): an unofficial educational rewrite on raylib.
- [Breakout](https://github.com/alicelanguage/alice/tree/main/samples/Breakout): a MonoGame game.
- [Wonderland adventure](https://github.com/alicelanguage/alice/tree/main/samples/wonderland): a text adventure using a Ruby-style DSL.

## Get started

Install with one command. The script verifies the release checksum, installs the .NET 10 SDK when it is missing (per-user, no Visual Studio), and puts `alice` on your PATH.

```sh
# Linux and macOS
curl -fsSL https://alice-lang.org/install.sh | sh
```

```powershell
# Windows (PowerShell)
irm https://alice-lang.org/install.ps1 | iex
```

Then manage versions rustup-style: `alice toolchain install nightly`, `alice toolchain default stable`, `alice toolchain pin 1.0.1` (per project), `alice +nightly run app.al`, and update with `alice self update`. `alice doctor` checks the setup.

Or build from source:

```sh
git clone https://github.com/alicelanguage/alice.git
cd alice
dotnet build Alice.sln --configuration Release
dotnet run --project src/Alice.Cli -- run examples/basics/hello.al
```

Release archives are available for Linux x64, Windows x64, macOS x64, and macOS arm64. See the [release installation guide](https://github.com/alicelanguage/alice/blob/main/docs/releases.md).

## Project status

The latest release is 1.0.1 (2026-11-04). See the [roadmap](https://alice-lang.org/roadmap/), the repository's documentation and the release notes for supported features and limitations. The optional front-page background is decorative.

## License and attribution

Source code: [Apache License 2.0](https://alice-lang.org/LICENSE).

The Alice name, rabbit mark, and brand images are © 2026 Julia Klee, all rights reserved. They are not covered by the code license. See the [brand assets license](https://alice-lang.org/brand/LICENSE.md).

## Community

- [Contribute](https://github.com/alicelanguage/alice/blob/main/CONTRIBUTING.md)
- [Report an issue](https://github.com/alicelanguage/alice/issues)
