Skip to content

Conversation

@hyperpolymath
Copy link
Owner

No description provided.

claude and others added 6 commits December 17, 2025 00:32
Add extensive documentation covering:

Roadmap (ROADMAP.md):
- Complete development roadmap through v1.0
- Phase-by-phase implementation plan
- Testing strategy with property-based testing
- Standard library and framework ecosystem plans
- Milestone definitions and release schedule

Wiki documentation (wiki/):
- Language reference: lexical structure, types, ownership,
  effects, traits, modules, dependent types, row polymorphism,
  patterns, functions
- Compiler implementation guides: architecture, lexer, parser,
  type checker, borrow checker, code generation
- Tooling: CLI reference, REPL guide
- Testing: comprehensive testing guide with property-based
  testing inspired by Echidna/QuickCheck
- Standard library overview
- Tutorials: introduction and quick start guide

This documentation provides a foundation for contributors and
users to understand the language design and implementation.
Implement a complete Menhir parser covering:

Expressions:
- Literals (int, float, string, char, bool, unit)
- Variables and field access
- Binary operators with correct precedence
- Unary operators (negation, not, ref, deref)
- Function calls and indexing
- Tuples, arrays, and records
- If/else and match expressions
- Lambda expressions
- Blocks and let bindings
- Effect handlers and resume

Types:
- Simple types and type constructors
- Generic types (Option[T], Vec[n, T])
- Function types with optional effects
- Tuple and record types
- Row polymorphism ({x: Int, ..r})
- Ownership modifiers (own, ref, mut)

Patterns:
- Wildcards, variables, literals
- Constructor patterns
- Tuple and record patterns
- Or-patterns and binding patterns

Declarations:
- Functions (with total, generic, effects)
- Structs and enums
- Type aliases
- Traits and implementations
- Effect declarations
- Imports and modules

Also includes:
- Parse driver bridging sedlex and Menhir
- Comprehensive parser test suite (60+ tests)
- CLI integration for 'parse' command
…ructure

Phase 2 implementation of AffineScript:

REPL & Interpreter:
- value.ml: Runtime value representation with linear tracking
- eval.ml: Tree-walking interpreter with pattern matching
- repl.ml: Interactive REPL with commands (:help, :env, :debug, etc.)
- stdlib.ml: Standard library modules (Math, String, Array, Option, Result)

Semantic Analysis:
- symbol.ml: Symbol table with scope management
- resolve.ml: Name resolution pass for all AST nodes
- types.ml: Internal type representation (QTT quantities, rows, effects)
- typecheck.ml: Bidirectional type checker with unification
- borrow.ml: Affine type borrow checker (use-after-move detection)

Code Generation:
- codegen.ml: WebAssembly code generator (WAT output)

CLI Updates:
- Added 'repl', 'run', and 'eval' commands
- Integrated stdlib prelude loading

Examples:
- hello.afs, fibonacci.afs, factorial.afs
- higher_order.afs, records.afs, enums.afs

Tests:
- test_eval.ml: 35+ interpreter tests
Add comprehensive compiler infrastructure:
- lib/wasm_binary.ml: Full WASM binary encoder with LEB128, sections
- lib/dependent.ml: Dependent types (length-indexed vectors, refinements)
- lib/effects.ml: Algebraic effects and handlers runtime
- lib/package.ml: Package manager with semver, dependency resolution
- lib/lsp.ml: Language Server Protocol implementation

Add standard library in library/:

Common library (library/common/):
- prelude.afs: Core types (Option, Result), traits (Eq, Ord, Iterator)
- collections.afs: Vec, HashMap, HashSet, LinkedList, BinaryHeap
- io.afs: IO effect, file handling, streams, buffered I/O
- async.afs: Futures, channels, async primitives
- string.afs: String utilities, StringBuilder
- math.afs: Math functions, constants, statistics, RNG
- time.afs: Duration, Instant, DateTime
- sync.afs: Atomics, spinlocks, RwLock, barriers

AffineScript-specific library (library/affinescript/):
- linear.afs: Linear types, tokens, session types
- effects.afs: Effect handlers (Reader, Writer, State, Except)
- ownership.afs: Box, Rc, Weak, Cow, RefCell
- refinements.afs: Positive, NonZero, Vec[N,T], Matrix[M,N,T]

Total: ~8400 lines of new code
Replace open_in with open_in_bin in file reading operations to ensure
consistent behavior across Windows and Unix systems. This addresses
Semgrep warning about CRLF line ending handling.

Files changed:
- lib/repl.ml: load_file function
- lib/package.ml: read_manifest function
- lib/parse_driver.ml: parse_file function
@hyperpolymath hyperpolymath merged commit d3fd8b4 into main Dec 17, 2025
1 of 3 checks passed
@hyperpolymath hyperpolymath deleted the claude/language-roadmap-planning-PjmQg branch December 17, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants