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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# TeapotLang Changelog

Every commit in the `Sim20004/teapot-lang` repository is represented below, from the initial repository creation through the latest commit. Descriptions summarise the changes made by each commit. PLEASE add changes to the top and not the bottom, look at the dates to ensure you've done it correctly.
This changelog records notable changes to TeapotLang. Entries are listed newest first; merge commits and routine maintenance may be grouped with the changes they contain.

# Unreleased

* 2026-11-27: Audited and updated the project documentation to reflect the current compiler, semantic analyser, CLI, and development roadmap.
* 2026-11-17: Applied Ruff cleanup and updated the pull-request template.
* 2026-11-17: Added property-based tests for simple numeric literals.
* 2026-11-14: Added property-based tests for balanced parentheses, numeric literals, and simple identifier names.
* 2026-11-09: Added parser tests for the `true` and `false` Boolean literals.
* 2026-11-07: Added branch-coverage tests and pinned the Ruff version used by CI.
* 2026-11-05: Adjusted type flexibility and expression-inference behaviour.
* 2026-11-08: Added parser tests for the `true` and `false` boolean literals, covering standalone assignments, variable declarations and binary expressions.
* 2026-11-07: Added tests to fill coverage gaps
* 2026-11-04: Fixed format, fixed various failing tests due to: addition of parameter in various functions, deprecation and removal of bounds checking code for future rewrite, and change of other code, and then fixed formatting again in three commits.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Semantic analysis
Future stages
```

The current implementation includes the lexer, parser, abstract syntax tree (AST), and semantic-analysis infrastructure. The pipeline is being extended towards the language specification.
The current implementation includes the lexer, parser, AST, symbol-table construction, and an initial second semantic pass. The type checker validates supported variable declarations and initialisers, literal types and bounds, selected binary expressions, identifier references in inferred expressions, and return expressions in functions and operators. This is a partial implementation, not complete static analysis.

The following distinctions matter:

Expand All @@ -124,7 +124,7 @@ A keyword being recognised, or an AST node existing, does not necessarily mean t

### What is not implemented yet?

Code generation and a complete executable runtime remain future work. TeapotLang therefore cannot yet compile a program into a finished executable through a complete end-to-end pipeline.
Assignment value checking, function-call argument validation, complete mutability and conversion rules, member resolution, full operator-overload resolution, code generation, and a complete executable runtime remain future work. TeapotLang therefore cannot yet compile a program into a finished executable through a complete end-to-end pipeline.

The language specification may describe capabilities beyond those currently supported. Check the [language reference](docs/language-reference.md) before relying on a particular feature.

Expand Down
274 changes: 96 additions & 178 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,178 +1,96 @@
TeapotLang Roadmap

TeapotLang is currently in Alpha.

This roadmap describes the planned direction of the language and may change as development progresses.

Current Status

TeapotLang is currently focused on building the core language infrastructure and compiler pipeline.

Alpha

* [x] Lexer
* [x] Parser
* [x] AST infrastructure
* [x] Struct declarations
* [x] Enum declarations
* [x] Function declarations
* [x] Operator overloading infrastructure
* [x] Symbol table
* [x] First-pass semantic analysis
* [ ] Complete semantic analysis
* [ ] Complete type checking
* [ ] Improve compiler diagnostics
* [ ] Stabilise the language specification

⸻

Phase 1: Language Foundations

The first priority is making the core language well-defined and reliable.

* [ ] Complete semantic analysis
* [ ] Complete type checking
* [ ] Finalise variable and declaration rules
* [ ] Finalise function and parameter rules
* [ ] Finalise struct semantics
* [ ] Finalise enum semantics
* [ ] Finalise operator overloading rules
* [ ] Improve scope and symbol resolution
* [ ] Define compile-time error behaviour
* [ ] Expand the language specification
* [ ] Document all core language features

⸻

Phase 2: Compiler Infrastructure

Build the infrastructure required to turn valid TeapotLang programs into executable code.

* [ ] Design intermediate representation
* [ ] Implement IR generation
* [ ] Implement backend architecture
* [ ] Add target architecture support
* [ ] Implement code generation
* [ ] Implement linking/runtime integration
* [ ] Add compiler optimisation infrastructure
* [ ] Improve compiler error messages
* [ ] Add source-location tracking throughout compilation

⸻

Phase 3: Memory Management

TeapotLang supports different memory-management models through compiler directives.

* [ ] Finalise memory-management semantics
* [ ] Implement automatic memory management
* [ ] Implement manual memory management
* [ ] Define ownership/lifetime behaviour where applicable
* [ ] Improve memory-related diagnostics
* [ ] Document memory-management behaviour

⸻

Phase 4: Standard Library

Build a useful standard library around the language.

* [ ] Core utilities
* [ ] Strings
* [ ] Collections
* [ ] File I/O
* [ ] Environment/process APIs
* [ ] Error handling utilities
* [ ] Standard library documentation
* [ ] Stable standard-library API

⸻

Phase 5: Developer Experience

Make TeapotLang pleasant to use outside the compiler itself.

* [ ] Improve compiler diagnostics
* [ ] Add a formatter
* [ ] Add language-server support
* [ ] Add editor integrations
* [ ] Improve CLI tooling
* [ ] Add project/package management
* [ ] Improve documentation
* [ ] Add tutorials and examples
* [ ] Create a comprehensive language reference

⸻

Phase 6: Ecosystem

Move from a language implementation to an ecosystem.

* [ ] Package registry
* [ ] Package publishing tooling
* [ ] Dependency management
* [ ] Third-party libraries
* [ ] Community examples
* [ ] Community tooling
* [ ] Plugin/extension system where appropriate

⸻

Stability

Before reaching a stable release, TeapotLang should have:

* [ ] A stable language specification
* [ ] Stable compiler behaviour
* [ ] Stable standard library APIs
* [ ] Predictable error reporting
* [ ] Cross-platform support
* [ ] Reproducible builds
* [ ] Comprehensive documentation
* [ ] Migration guidance between releases
* [ ] Versioning policy
* [ ] Backwards-compatibility policy

⸻

Release Targets

Alpha

Goal: Rapid language and compiler development.

Focus:

* Core language features
* Parser and AST
* Semantic analysis
* Type checking
* Compiler architecture

Breaking changes are expected.

Beta

Goal: Feature-complete language suitable for wider testing.

Focus:

* Stable language semantics
* Compiler reliability
* Standard library
* Developer tooling
* Documentation
* Cross-platform support

Breaking changes should become increasingly rare.

1.0

Goal: A stable TeapotLang release suitable for production use.

Requirements:

* Stable specification
* Stable compiler
* Stable standard library
* Documented compatibil
# TeapotLang roadmap

TeapotLang is in alpha. This roadmap describes the intended direction of the project, not a promise of release dates. Items marked complete refer only to the scope stated in that item; they do not imply that the whole language feature is finished.

## Current status

The lexer, parser, AST, CLI, and initial semantic-analysis infrastructure are implemented. Semantic analysis currently has a declaration-and-scope pass followed by a partial type-checking pass. The compiler does not yet generate executable code or provide a language runtime.

### Alpha foundations

- [x] Lexer and token definitions
- [x] Parser and AST infrastructure
- [x] Core declaration syntax for variables, functions, structs, enums, errors, and operators
- [x] Initial symbol table and parent/child scope lookup
- [x] Declaration registration and duplicate-name detection
- [x] Initial semantic type checks for supported declarations, literals, expressions, and callable returns
- [ ] Complete semantic analysis and type checking
- [ ] Assignment value and mutability validation
- [ ] Function-call argument validation
- [ ] Condition and control-flow validation
- [ ] Complete member, cast, and operator-overload resolution
- [ ] Finalise core language semantics and specification

## Phase 1: Language foundations

Make the core language rules reliable and unambiguous.

- [ ] Define and implement assignment compatibility and mutability rules
- [ ] Validate function-call argument counts and types
- [ ] Validate conditions and control-flow requirements
- [ ] Complete type conversions and cast validation
- [ ] Resolve struct fields and enum members
- [ ] Define and implement operator-overload resolution
- [ ] Complete return-path and callable validation
- [ ] Finalise variable, function, struct, enum, and error semantics
- [ ] Improve semantic diagnostics and source locations
- [ ] Keep the language reference aligned with implemented behaviour

## Phase 2: Compiler infrastructure

Build the stages needed to produce executable programs.

- [ ] Design an intermediate representation
- [ ] Implement IR generation and lowering
- [ ] Design a backend interface
- [ ] Select and support an initial target architecture
- [ ] Implement code generation
- [ ] Integrate linking and runtime support
- [ ] Add compiler optimisation infrastructure

## Phase 3: Memory management

The source directives currently record a selected mode; they do not implement memory management.

- [ ] Finalise memory-management semantics
- [ ] Define ownership, aliasing, and lifetime rules
- [ ] Implement automatic memory management
- [ ] Implement manual memory management
- [ ] Add memory-related diagnostics and tests

## Phase 4: Runtime and standard library

- [ ] Design and implement the runtime
- [ ] Add core utilities and input/output
- [ ] Add strings and collections
- [ ] Add filesystem and process APIs
- [ ] Add runtime error-handling facilities
- [ ] Document and stabilise standard-library APIs

## Phase 5: Developer experience

- [ ] Improve CLI diagnostics and tooling
- [ ] Add a formatter
- [ ] Add language-server support
- [ ] Add editor integrations
- [ ] Add project and package management
- [ ] Add tutorials and practical examples

## Phase 6: Ecosystem

- [ ] Design package publishing and dependency management
- [ ] Establish a package registry
- [ ] Encourage third-party libraries and community examples
- [ ] Consider a plugin or extension system where it is useful

## Before a stable 1.0 release

- [ ] Stable language specification and compiler behaviour
- [ ] Usable runtime and standard library
- [ ] Predictable diagnostics
- [ ] Cross-platform support
- [ ] Reproducible builds and release process
- [ ] Migration guidance and compatibility policy
- [ ] Complete user and developer documentation

Breaking language and compiler changes are expected during alpha. Priorities may change as implementation and language design develop.
11 changes: 6 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ The documentation uses several terms to avoid confusing language design with com

| Term | Meaning |
| --------------- | ----------------------------------------------------------------------------------------------------- |
| **Implemented** | The relevant compiler behaviour exists |
| **Parsed** | The parser constructs an AST representation |
| **Recognised** | The lexer recognises the syntax |
| **Represented** | A compiler data structure exists, but the feature may not be parser-supported |
| **Design** | The feature belongs to the intended language model but is not currently established by implementation |
| **Implemented** | The relevant behaviour exists in the compiler stage being described. This does not imply that later stages or runtime support are complete. |
| **Partial** | Some semantic or compiler behaviour exists, but important validation or execution rules remain unfinished. |
| **Parsed** | The parser constructs an AST representation, but later compiler stages may not support it. |
| **Recognised** | The lexer recognises the syntax, but the parser may not accept it. |
| **Represented** | A compiler data structure exists, but the feature may not be parser-supported. |
| **Design** | The feature belongs to the intended language model but is not implemented yet. |

A keyword, token, or AST dataclass does **not** by itself mean that a feature is usable.

Expand Down
38 changes: 22 additions & 16 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,21 @@ After installing the package:
teapot examples/hello.tp
```

The CLI accepts:
The CLI accepts an input `.tp` file and the following options:

```text
input (positional) Input TeapotLang source file. Required.
-t, --trace Enable compiler diagnostic output.
--version Display the compiler version.
-t, --trace, --debug Enable compiler trace output.
-q, --quiet Suppress informational and trace output.
-v, --verbose Increase informational output (repeat for more detail).
--color {auto,always,never}
Control terminal colours.
--diagnostic-format {text,json}
Select human-readable or JSON diagnostics.
--diagnostic-detail {concise,normal,full}
Select diagnostic detail.
--log-file PATH Write trace and diagnostic output to a file.
--no-log Disable log-file output.
--version Display the compiler version.
```

For example:
Expand Down Expand Up @@ -136,20 +145,17 @@ The AST is the interface between parsing and later compiler stages. When adding

`src/teapot/semantic/pass1.py` performs the first stage of semantic analysis.

The current implementation includes:
The first pass in `src/teapot/semantic/pass1.py` currently provides:

* `Symbol`;
* `SymbolTable`;
* parent/child scope lookup;
* global scope construction;
* variable declaration registration;
* function declaration registration;
* function scopes;
* struct declaration registration;
* global, function, operator, struct, enum, error, and nested block scopes;
* symbol registration for variables, functions, parameters, structs and fields, enums and members, errors and members, and operators and arguments;
* parent-scope lookup and child-scope shadowing;
* duplicate declaration detection; and
* function parameter metadata.
* checks that assignment targets name an existing identifier.

The analyser currently has a first-pass symbol-table phase and a second-pass type-checking phase. The second-pass `TypeChecker` is present but does not yet implement type-checking rules.
The second pass in `src/teapot/semantic/pass2.py` is an initial type checker, not an empty placeholder. It currently validates built-in variable datatypes, literal Python types and numeric bounds, supported variable initialisers, selected binary-expression combinations, identifier references used by supported expressions, and return-expression compatibility inside functions and operators. It also traverses the supported nested control-flow bodies.

Important gaps remain: assignment right-hand-side compatibility, function-call argument count and types, complete mutability enforcement, condition typing, member and field resolution, complete cast rules, and proper overload resolution are not implemented. Unknown or unsupported expression forms may remain untyped rather than being rejected.

Semantic failures raise `SemanticError`.

Expand Down Expand Up @@ -292,7 +298,7 @@ Pass 2

The exact division between passes may evolve as implementation continues.

Current symbol-table behaviour should be tested independently from future type-checking behaviour.
Keep tests for symbol-table construction separate from tests for the current, deliberately partial type-checking rules. When adding a semantic rule, test both accepted and rejected programs, including nested scopes where relevant.

## Trace output

Expand Down
Loading
Loading