This guide explains how to set up a development environment to contribute to Elo.
To run all tests (including acceptance tests), you need:
- Node.js (v22+): The compiler is written in TypeScript
- Ruby (3.x): For Ruby acceptance tests
- PostgreSQL (14+): For SQL acceptance tests
Alternatively, use the Docker setup in .claude/safe-setup/ which provides all dependencies pre-configured. See .claude/safe-setup/HACKING.md for details.
# Clone the repository
git clone https://github.com/enspirit/elo-lang.git
cd elo-lang
# Install dependencies
npm install
# Run the test suite
npm testElo is developed using TDD. The test suite has three levels:
# Unit tests - core functions and utilities
npm run test:unit
# Integration tests - compiler output against fixtures
npm run test:integration
# Acceptance tests - actual execution in Ruby, Node, PostgreSQL
npm run test:acceptance
# Run all tests
npm testAll tests must pass before committing.
src/
parser.ts # Elo grammar and parser
ast.ts # AST types and factory
types.ts # Type system
ir.ts # Intermediate representation
transform.ts # AST to IR with type inference
stdlib.ts # Standard library abstraction
compilers/ # Target language code generators
javascript.ts
ruby.ts
sql.ts
cli.ts # CLI implementation
test/
unit/ # Unit tests
integration/ # Compiler output tests
acceptance/ # Cross-runtime execution tests
fixtures/ # Test fixtures (.elo files)
web/ # Try Elo website (Astro)
When adding a new language construct or stdlib function:
- Add parser support with unit tests
- Update IR if needed
- Add acceptance test fixtures (
.elofiles with assertions) - Implement in all three compilers
- Document in README and website (Learn, Reference, Stdlib sections)
- Run all tests
See CLAUDE.md for detailed development workflow.
# Compile an expression
./bin/eloc "1 + 2" --target js
# Evaluate an expression
./bin/eloc "1 + 2" --target js --run
# Use the elo evaluator
echo "1 + 2" | ./bin/elocd web
npm install
npm run dev # Start dev server at localhost:4321
npm run build # Build for production