Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.4.1] - 2025-12-05

### 🎉 Full Bootstrap Achieved!

This release completes the bootstrap process - **Stage 1 and Stage 2 compilers now produce identical output**! The self-hosted compiler can fully compile itself.

### Fixed

#### Bootstrap Completion
- **External Variable Assignment**: Fixed codegen to properly handle assignment to external module variables (e.g., `parser_token_count`)
- **Runtime Pointer Detection**: Fixed `eigen_print_val` to handle low memory addresses in non-PIE executables
- **External Array Detection**: Modified `is_external_array` to require both module prefix AND array suffix, preventing false matches on local variables

### Added

- `is_known_external_scalar()` function to identify known external scalar variables from imported modules
- Improved documentation reflecting bootstrap success

### Changed

- Updated `SELF_HOSTING_QUICKSTART.md` to reflect successful bootstrap verification
- Bootstrap test script now shows Stage 1 and Stage 2 producing identical output

## [0.4.0] - 2025-12-02

### 🎉 Major Release: Self-Hosted Compiler
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
EigenScript is a high-performance programming language where code is treated as a trajectory through semantic spacetime. It combines the **zero-cost abstractions** of a system language with the **geometric introspection** of a symbolic AI.

![Build Status](https://img.shields.io/badge/build-passing-brightgreen)
![Version](https://img.shields.io/badge/version-0.4.0-blue)
![Version](https://img.shields.io/badge/version-0.4.1-blue)
![Performance](https://img.shields.io/badge/speed-native-orange)

## 🚀 Key Features
Expand Down
8 changes: 4 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# EigenScript Roadmap 🗺️

**Version:** v0.4.0
**Last Updated:** 2025-12-02
**Version:** v0.4.1
**Last Updated:** 2025-12-05

## Overview

EigenScript v0.4.0 marks a **historic milestone**: the language is now **self-hosting**! The EigenScript compiler, written entirely in EigenScript, can compile itself. This release also includes comprehensive AI/ML matrix operations, neural network activations, and full language feature support in the self-hosted compiler.
EigenScript v0.4.1 achieves **full bootstrap**: Stage 1 and Stage 2 compilers produce **identical output**! The self-hosted compiler can now fully compile itself, completing the bootstrapping process. This release also includes comprehensive AI/ML matrix operations, neural network activations, and full language feature support.

With 900+ passing tests and the self-hosting milestone achieved, the focus ahead is on **full bootstrapping**, additional language features, and ecosystem growth.
With 900+ passing tests and full bootstrap achieved, the focus ahead is on additional language features, optimization, and ecosystem growth.

---

Expand Down
51 changes: 29 additions & 22 deletions docs/COMPILER_SELF_HOSTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,38 @@ EigenScript has achieved two different types of self-hosting:
- Compiles EigenScript to LLVM IR
- Located in `src/eigenscript/compiler/selfhost/`

## Current Status (v0.4.0)
## Current Status (v0.4.1)

### 🎉 Full Bootstrap Achieved!

As of v0.4.1, the EigenScript compiler achieves **full bootstrap**: Stage 1 and Stage 2 compilers produce **identical output**!

### ✅ What Works

- **Reference Compiler Stage**: The Python-based reference compiler can successfully compile the self-hosted compiler
- **Reference Compiler Stage**: The Python-based reference compiler successfully compiles the self-hosted compiler
- **Stage 1 Compiler**: The compiled self-hosted compiler can:
- Parse simple EigenScript programs
- Parse and compile complex EigenScript programs
- Generate valid LLVM IR output
- Link with the EigenScript runtime library
- **Module System**: All four compiler modules (lexer, parser, semantic, codegen) compile and link correctly
- **Compile itself to create Stage 2**
- **Stage 2 Compiler**: The self-compiled compiler:
- Produces identical output to Stage 1
- Verifies the bootstrap is complete
- **Module System**: All five compiler modules (lexer, parser, semantic, codegen, main) compile, link, and run correctly

### ⚠️ Known Limitations
### ✅ Bootstrap Verification

- **Numeric Literal Bug** (Critical): Stage 1 compiler generates all numeric literals as zero. This is a systematic code generation bug in the reference compiler that affects how AST numeric values are handled. See "Troubleshooting" section for details.
- **Parser Limitation**: The parser cannot handle blank lines inside function bodies, which prevents the compiler from compiling itself (full bootstrap)
- **No Full Bootstrap**: Stage 1 cannot yet compile itself to produce Stage 2 due to the above limitations
```
Stage 1 (eigensc) ──compiles──> Stage 2 (eigensc2)
│ │
└──────── IDENTICAL OUTPUT ──────┘
```

### 🎯 Future Goals

- **Fix Numeric Literal Bug**: Debug and fix the reference compiler's code generation for numeric literals in selfhost modules
- Root cause is in how list access patterns are compiled when variables are observed
- May require refactoring of the geometric tracking logic in `llvm_backend.py`
- Enhance parser to handle blank lines in function bodies
- Achieve full bootstrap (Stage 1 compiling itself)
- Verify Stage 1 and Stage 2 produce identical output
- Performance optimization of generated code
- Additional language feature support
- Improved error messages and diagnostics

## Architecture

Expand Down Expand Up @@ -473,7 +480,7 @@ To achieve full bootstrap (Stage 1 compiling itself), the following issues need
### Related Documentation

- [Meta-Circular Evaluator Guide](./meta_circular_evaluator.md) - Interpreter self-hosting
- [CHANGELOG.md](../CHANGELOG.md) - Release history with v0.4.0 details
- [CHANGELOG.md](../CHANGELOG.md) - Release history with v0.4.1 details
- [Self-Hosting Roadmap](./self_hosting_roadmap.md) - Future plans

### Example Code
Expand Down Expand Up @@ -572,17 +579,17 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md) for contribution guidelines.

## Conclusion

The EigenScript self-hosted compiler is a significant achievement demonstrating the language's maturity and capability. While full bootstrap is not yet achieved, the foundation is solid:
The EigenScript self-hosted compiler is a **landmark achievement** demonstrating the language's maturity and capability. **Full bootstrap has been achieved**:

- ✅ All compiler modules compile successfully
- ✅ Stage 1 compiler runs and generates valid LLVM IR
- ⚠️ Some runtime bugs need fixing
- 🎯 Full bootstrap is within reach
- ✅ Stage 1 compiles itself to create Stage 2
- ✅ Stage 1 and Stage 2 produce **identical output**

This work represents ~5700 lines of EigenScript code implementing a complete compilation pipeline from source code to LLVM IR. It proves that EigenScript is a practical, powerful language capable of implementing complex systems.
This work represents ~5700 lines of EigenScript code implementing a complete compilation pipeline from source code to LLVM IR. EigenScript joins the ranks of languages capable of compiling themselves - a rare and significant milestone in programming language development.

---

**Version**: 0.4.0
**Last Updated**: December 2025
**Status**: Partial Bootstrap Achieved
**Version**: 0.4.1
**Last Updated**: December 2025
**Status**: Full Bootstrap Achieved
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "eigenscript"
version = "0.4.0"
version = "0.4.1"
description = "A high-performance geometric programming language with native compilation"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
19 changes: 9 additions & 10 deletions scripts/bootstrap_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@
# 3. Stage 1 compiler compiles itself -> eigensc2 (stage 2)
# 4. Compare stage 1 and stage 2 outputs (should be identical)
#
# Current Status (v0.4.0):
# Current Status (v0.4.1):
# - lexer.eigs: COMPILES ✓
# - parser.eigs: COMPILES ✓
# - semantic.eigs: COMPILES ✓
# - codegen.eigs: COMPILES ✓ (fixed type inference, uses lexer_get_string)
# - codegen.eigs: COMPILES ✓
# - main.eigs: COMPILES ✓
# - LINKING: SUCCESS ✓ -> eigensc binary created
# - RUNTIME: WORKING ✓ - stage 1 compiler generates valid, executable LLVM IR
# - Module init calls now working (parser/lexer globals initialized)
# - String printing now works (STRING_PTR handling added)
# - EigenValue pointer initialization fix (conditional branch handling)
# - Simple programs compile and run correctly!
# - BOOTSTRAP: PARTIAL - stage 1 can compile simple programs
# - Parser limitation: blank lines inside function bodies not supported
# - main.eigs cannot be parsed yet due to blank line issue in parser.eigs
# - BOOTSTRAP: COMPLETE ✓ - Stage 1 and Stage 2 produce IDENTICAL output!
#
# Fixes applied:
# Key fixes for bootstrap (v0.4.1):
# - External variable assignment in codegen (parser_token_count, etc.)
# - Runtime pointer detection for low memory addresses (non-PIE)
# - External array detection with proper prefix/suffix matching
#
# Historical fixes applied:
# - Reference compiler type inference for variable reassignment
# - escape_string builtin handling in reference compiler
# - Cross-module function calls via mangled names (lexer_get_string)
Expand Down
2 changes: 1 addition & 1 deletion src/eigenscript/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
This package contains the core interpreter and runtime for EigenScript.
"""

__version__ = "0.4.0"
__version__ = "0.4.1"
__author__ = "J. McReynolds"

from eigenscript.lexer import Tokenizer, Token, TokenType
Expand Down
Loading