JVM Language · Java 21 · Robust Parser

Code that tastes
like espresso.

Affogato is a JVM language designed to be

Guard.aff Affogato
describe(value: Object): String {
  guard value is String else {
    return "other"
  }
  return value as String
}
Guard.java Java 21
public String describe(Object value) {
  if (!(value instanceof String)) {
    return "other";
  }
  return ((String) value);
}
JVM Native Java 21 Robust Parser Type Safety Named Arguments Nullable Types Guard Clauses Switch Expressions Records Enums Interfaces Gradle Plugin IntelliJ Support Java Interop Lambdas Method References JVM Native Java 21 Robust Parser Type Safety Named Arguments Nullable Types Guard Clauses Switch Expressions Records Enums Interfaces Gradle Plugin IntelliJ Support Java Interop Lambdas Method References
Features

Brewed for developers.

Everything you need to write expressive, type-safe JVM code with zero friction.

🔒

Null Safety

First-class nullability with String? nullable and String! non-null markers. Compile-time enforcement with runtime annotations.

100% Java Interop

Seamless integration with any Java library. Call Java methods, use lambdas, method references, generics, and static imports.

🎯

Named Arguments

Reorder function arguments by name for maximum readability. Works across Affogato and Java calls with overload resolution.

Robust Parser

Robust grammar-based parser replaces fragile line-by-line parsing. Accurate diagnostics with stable error codes.

🧩

Gradle Integration

First-class Gradle plugin wires .aff compilation into your build. Configuration-cache compatible with cacheable tasks.

🔬

IntelliJ Plugin

Syntax highlighting, navigation, rename, and live compiler diagnostics directly in your editor. Built with Grammar-Kit.

🛡️

Guard Clauses

Swift-inspired guard condition else for early exits. Clean, readable defensive programming built into the language.

📦

Records & Enums

Compact record constructors like record Coord(x: int, y: int). Full enum and interface support with default methods.

🔀

Switch Expressions

Modern switch as both statements and expressions. Arrow syntax case … -> with multi-label arms and block bodies.

Syntax

Expressive by design.

Affogato strips away the boilerplate while keeping everything familiar.

records-classes.aff
// Compact record constructors
record Point(x: int, y: int)
record User(name: String!, email: String?)

// Inheritance with : operator
class Animal {
  var name: String!

  init(name: String!) {
    this.name = name
  }

  speak(): String { return "..." }
}

class Dog : Animal {
  override speak(): String {
    return "Woof! I'm " + name
  }
}
control-flow.aff
// Guard for early exits
processOrder(id: int): String {
  guard id > 0 else {
    return "Invalid order ID"
  }

  // Switch expressions
  let status = switch id % 3 {
    case 0 -> "shipped"
    case 1 -> "pending"
    default -> "processing"
  }

  // For-in loops
  for item in items {
    println(item.name + ": " + status)
  }

  return status
}
nullability.aff
// Type! = non-null (compile-time check)
// Type? = nullable
var name: String! = "Alex"
var email: String? = null

// Compile error: null → non-null
// var bad: String! = null ✗

// is = instanceof check
var obj: Object = "hello"
if obj is String {
  println("It's a String!")
}

// as = cast
let s = obj as String
println(s.toUpperCase())
java-interop.aff
import java.util.List
import java.util.stream.Collectors
import static java.util.Collections.sort

demo(): List<String> {
  // Collection aliases
  var items: List<String> = List<String>()
  items.add("espresso")
  items.add("affogato")

  // Lambdas with Java functional interfaces
  var upper = items.stream()
    .map(s -> s.toUpperCase())
    .collect(Collectors.toList())

  sort(upper)
  return upper
}
Quick Start

Ready in minutes.

Get Affogato running in your project with just a few lines of Gradle config.

1

Add the Gradle plugin

// build.gradle.kts
plugins {
  id("dev.affogato") version "0.1.0"
}
2

Write your first .aff file

// src/main/affogato/Hello.aff
package com.example

class Hello {
  static func main(args: String[]) {
    println("Hello from Affogato ☕")
  }
}
3

Build and run

# Compiles .aff → Java → bytecode
./gradlew run

# Or compile only
./gradlew compileAffogato

📂 Project Structure

📁 my-project/
📁 src/
📁 main/
📁 affogato/
Main.aff
Service.aff
📁 java/
Utils.java
📄 build.gradle.kts
📄 settings.gradle.kts

The Gradle plugin auto-discovers .aff files and wires them into your build.

Read Gradle Docs →
Java 21
Target platform
4
Core modules
Grammar
Parser backbone
100%
Java interop
Roadmap

What's brewing.

The journey from MVP to a full-featured JVM language.

Language grammar & parser Done

Replaced line-based parsing with robust grammar.

Semantic symbol tables Done

Project-wide class, field, method and constructor resolution.

Java classpath reflection Done

URLClassLoader-based method param names and getter discovery.

Named arguments & overload resolution Done

Strict, loose and varargs phases with most-specific tie breaking.

Type checking & flow analysis Done

Field/local initializers, return expressions, assignment checks.

Records, Enums & Interfaces Done

Full support with compact constructors and default methods.

Switch statements/expressions Done

Arrow syntax, multi-label arms and block bodies.

Try/Catch/Finally & multi-catch Done

Full exception handling with multi-catch via pipe syntax.

Gradle plugin (cache-compatible) Done

Configuration-cache and incremental build support.

IntelliJ plugin with diagnostics Done

Grammar-Kit, JFlex, live compiler errors in editor.

Dedicated semantic pass

Move type-checker into a proper AST pass.

Full JLS overload corner cases

Target-typed poly expressions and capture conversion.

IntelliJ completion & quick fixes

Import-aware references, code completion and formatting.

Bytecode backend

Direct bytecode generation beyond Java source transpilation.

Plugin portal publication

Gradle Plugin Portal and JetBrains Marketplace distribution.

Start building with Affogato.

The language that makes JVM development feel like a perfectly pulled espresso shot.