The language module for Kite - an Infrastructure as Code (IaC) language designed as a modern alternative to Terraform.
This module contains the parser, type checker, interpreter, and standard library that power the Kite language.
// import statements
import Bucket from "aws/s3"
import Instance from "aws/ec2"
// Declare a resource
resource Bucket photos {
name = "my-photos-bucket"
}
// Define a reusable component
component WebServer {
input number port = 8080
resource Instance server {
size = "t2.micro"
}
output string endpoint = server.publicIp
}
// instantiate the component
component WebServer server {
port = 8080
}
// Use types and string interpolation
var name = "production"
var label = "Environment: $name"
kite-language/
βββ grammar/ # ANTLR4 grammar files (KiteLexer.g4, KiteParser.g4)
βββ src/
β βββ main/java/cloud/kitelang/
β β βββ syntax/ # Lexer, parser, AST
β β βββ semantics/ # TypeChecker, scope, decorators
β β βββ execution/ # Interpreter, environment, values
β β βββ stdlib/ # 88 built-in functions
β β βββ analysis/ # Visitors, SyntaxPrinter
β β βββ tool/ # Terminal theming
β βββ test/java/cloud/kitelang/
β βββ ... # 121 test files, 8500+ tests
βββ docs/ # Architecture and design documentation
βββ build.gradle
- Java 25 or later
- Gradle 9.4 (wrapper included)
# Build the module ./gradlew build # Run tests ./gradlew test # Run a specific test ./gradlew test --tests "*.StructTest" # Regenerate ANTLR grammar sources ./gradlew clean generateGrammarSource
Note: This module depends on
kite-api, which must be cloned as a sibling directory. See Getting Started for setup instructions.
| Feature | Description |
|---|---|
| Resources & Components | Infrastructure declarations with inputs/outputs |
| Schemas & Structs | Type definitions for structured data |
| Imports | import * from "filepath" with environment isolation |
| Decorators | 15 built-in (@existing, @sensitive, @count, @cloud, etc.) |
| String Interpolation | "Hello $name" and "Sum: ${a + b}" |
| Union Types | type Status = "active" | "inactive" |
| Function Types | (number, number) -> number |
| Standard Library | 88 built-in functions |
| Document | Description |
|---|---|
docs/SYNTAX.md |
Complete language syntax reference |
docs/FEATURES.md |
Feature catalog with examples |
docs/DECORATORS.md |
All 15 built-in decorators |
docs/TESTING.md |
Testing strategy and organization |
docs/DEPENDENCY_RESOLUTION.md |
Observer pattern, 4-phase resolution |
docs/LOOP_RESOURCE_DEPENDENCIES.md |
Indexed resource names in loops |
kite-language is a standalone module. The only build dependency is kite-api (shared interfaces and annotations). Clone both repos side by side:
# Clone both repos into the same parent directory
git clone git@github.com:kitecorp/kite-language.git
git clone git@github.com:kitecorp/kite-api.gitYour directory structure should look like:
parent-dir/
βββ kite-language/ # This repo
βββ kite-api/ # Build dependency (interfaces only)
kite-apimust be in a sibling directory (../kite-api) β this is configured insettings.gradleas a Gradle composite build.
Build and verify:
cd kite-language ./gradlew build ./gradlew test
# Create a feature branch git checkout -b feature/my-change # Make your changes, commit, and push git add . git commit -m "Add my feature" git push origin feature/my-change
Then open a pull request against the kite-language repository.
- Test-Driven Development (TDD) β write tests first, watch them fail, then implement
- Clean Architecture β DRY, KISS, SOLID principles
- Explicit over implicit β parser validates syntax, type checker validates semantics
- Naming conventions β PascalCase for types/resources/components, camelCase for variables/functions
# All tests ./gradlew test # Specific test class ./gradlew test --tests "*.StructTest" # Tests matching a pattern ./gradlew test --tests "*typechecker*"
If you modify the ANTLR grammar files (grammar/KiteLexer.g4 or grammar/KiteParser.g4), regenerate sources before building:
./gradlew clean generateGrammarSource
- Ensure all tests pass (
./gradlew test) - Add tests for new features or bug fixes
- Update documentation in
docs/if your change affects language behavior - Update
docs/FEATURES.mdwhen completing a new feature - Keep commits focused and descriptive
Kite uses a two-phase execution model that catches all errors before any cloud provisioning happens:
Phase 1: Source β Lexer β Parser β AST β TypeChecker β Interpreter β ResourceValue[]
Phase 2: ResourceValue[] β Engine β Cloud APIs β Database State
This project is licensed under the Apache License 2.0.