uada80 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- uada80-0.2.0/PKG-INFO +244 -0
- uada80-0.2.0/README.md +217 -0
- uada80-0.2.0/pyproject.toml +100 -0
- uada80-0.2.0/setup.cfg +4 -0
- uada80-0.2.0/tests/test_acats.py +249 -0
- uada80-0.2.0/tests/test_access_types.py +426 -0
- uada80-0.2.0/tests/test_aggregates.py +307 -0
- uada80-0.2.0/tests/test_array_attributes.py +411 -0
- uada80-0.2.0/tests/test_aspects.py +175 -0
- uada80-0.2.0/tests/test_attributes.py +702 -0
- uada80-0.2.0/tests/test_child_packages.py +232 -0
- uada80-0.2.0/tests/test_codegen.py +534 -0
- uada80-0.2.0/tests/test_compiler.py +675 -0
- uada80-0.2.0/tests/test_contract_attributes.py +150 -0
- uada80-0.2.0/tests/test_contracts.py +259 -0
- uada80-0.2.0/tests/test_control_flow.py +629 -0
- uada80-0.2.0/tests/test_controlled.py +220 -0
- uada80-0.2.0/tests/test_declare_expr.py +149 -0
- uada80-0.2.0/tests/test_default_expressions.py +165 -0
- uada80-0.2.0/tests/test_delta_aggregate.py +124 -0
- uada80-0.2.0/tests/test_derived_types.py +214 -0
- uada80-0.2.0/tests/test_discriminated.py +214 -0
- uada80-0.2.0/tests/test_enums.py +444 -0
- uada80-0.2.0/tests/test_exceptions.py +227 -0
- uada80-0.2.0/tests/test_execution.py +3076 -0
- uada80-0.2.0/tests/test_expression_function.py +147 -0
- uada80-0.2.0/tests/test_expression_functions.py +162 -0
- uada80-0.2.0/tests/test_extended_return.py +156 -0
- uada80-0.2.0/tests/test_generics.py +485 -0
- uada80-0.2.0/tests/test_integration.py +755 -0
- uada80-0.2.0/tests/test_interfaces.py +224 -0
- uada80-0.2.0/tests/test_ir.py +475 -0
- uada80-0.2.0/tests/test_iterated_component.py +149 -0
- uada80-0.2.0/tests/test_lexer.py +315 -0
- uada80-0.2.0/tests/test_limited_with.py +145 -0
- uada80-0.2.0/tests/test_lowering.py +2046 -0
- uada80-0.2.0/tests/test_membership.py +177 -0
- uada80-0.2.0/tests/test_modular_types.py +402 -0
- uada80-0.2.0/tests/test_named_notation.py +191 -0
- uada80-0.2.0/tests/test_null_procedures.py +126 -0
- uada80-0.2.0/tests/test_operators.py +224 -0
- uada80-0.2.0/tests/test_optimizer.py +701 -0
- uada80-0.2.0/tests/test_overloading.py +184 -0
- uada80-0.2.0/tests/test_parallel.py +198 -0
- uada80-0.2.0/tests/test_parser.py +2516 -0
- uada80-0.2.0/tests/test_pragmas.py +558 -0
- uada80-0.2.0/tests/test_private_types.py +148 -0
- uada80-0.2.0/tests/test_protected_types.py +276 -0
- uada80-0.2.0/tests/test_quantified.py +139 -0
- uada80-0.2.0/tests/test_raise_expr.py +142 -0
- uada80-0.2.0/tests/test_records.py +407 -0
- uada80-0.2.0/tests/test_reduction.py +146 -0
- uada80-0.2.0/tests/test_renaming.py +193 -0
- uada80-0.2.0/tests/test_representation.py +196 -0
- uada80-0.2.0/tests/test_semantic.py +837 -0
- uada80-0.2.0/tests/test_stdlib.py +299 -0
- uada80-0.2.0/tests/test_strings.py +146 -0
- uada80-0.2.0/tests/test_subprograms.py +748 -0
- uada80-0.2.0/tests/test_subtypes.py +182 -0
- uada80-0.2.0/tests/test_symbol_table.py +477 -0
- uada80-0.2.0/tests/test_target_name.py +154 -0
- uada80-0.2.0/tests/test_tasking.py +415 -0
- uada80-0.2.0/tests/test_type_system.py +523 -0
- uada80-0.2.0/tests/test_use_clause.py +190 -0
- uada80-0.2.0/uada80/__init__.py +7 -0
- uada80-0.2.0/uada80/ast_nodes.py +1426 -0
- uada80-0.2.0/uada80/codegen/__init__.py +7858 -0
- uada80-0.2.0/uada80/compiler.py +487 -0
- uada80-0.2.0/uada80/ir.py +679 -0
- uada80-0.2.0/uada80/lexer.py +628 -0
- uada80-0.2.0/uada80/lowering.py +14141 -0
- uada80-0.2.0/uada80/main.py +111 -0
- uada80-0.2.0/uada80/optimizer/__init__.py +25 -0
- uada80-0.2.0/uada80/optimizer/ast_optimizer.py +1059 -0
- uada80-0.2.0/uada80/optimizer/config.py +160 -0
- uada80-0.2.0/uada80/parser.py +3828 -0
- uada80-0.2.0/uada80/runtime_manager.py +330 -0
- uada80-0.2.0/uada80/semantic.py +5069 -0
- uada80-0.2.0/uada80/symbol_table.py +6360 -0
- uada80-0.2.0/uada80/type_system.py +1327 -0
- uada80-0.2.0/uada80.egg-info/PKG-INFO +244 -0
- uada80-0.2.0/uada80.egg-info/SOURCES.txt +84 -0
- uada80-0.2.0/uada80.egg-info/dependency_links.txt +1 -0
- uada80-0.2.0/uada80.egg-info/entry_points.txt +2 -0
- uada80-0.2.0/uada80.egg-info/requires.txt +8 -0
- uada80-0.2.0/uada80.egg-info/top_level.txt +1 -0
uada80-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: uada80
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Ada compiler targeting Z80 processor
|
|
5
|
+
Author: uada80 project
|
|
6
|
+
License: GPLv2
|
|
7
|
+
Project-URL: Homepage, https://github.com/avwohl/uada80
|
|
8
|
+
Project-URL: Repository, https://github.com/avwohl/uada80
|
|
9
|
+
Keywords: ada,compiler,z80,retro,embedded
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: upeepz80>=0.1.0
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
24
|
+
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
|
25
|
+
Requires-Dist: black>=23.7.0; extra == "dev"
|
|
26
|
+
Requires-Dist: ruff>=0.0.285; extra == "dev"
|
|
27
|
+
|
|
28
|
+
# uada80 - Ada Compiler for Z80/CP/M
|
|
29
|
+
|
|
30
|
+
An Ada compiler targeting the Z80 processor and CP/M 2.2 operating system, aiming for ACATS (Ada Conformity Assessment Test Suite) compliance.
|
|
31
|
+
|
|
32
|
+
## Project Status
|
|
33
|
+
|
|
34
|
+
🔧 **Alpha** - Core compiler functionality implemented
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
uada80 is a compiler for the Ada programming language that generates code for the Z80 8-bit microprocessor running CP/M 2.2. The project aims to support a substantial subset of Ada 2012 and pass the ACATS conformance tests.
|
|
39
|
+
|
|
40
|
+
**Target Platform**: CP/M 2.2 on Z80
|
|
41
|
+
- Programs load at 0x0100
|
|
42
|
+
- Access to CP/M BDOS for file I/O and console operations
|
|
43
|
+
- Approximately 57K TPA on typical 64K system
|
|
44
|
+
|
|
45
|
+
### Goals
|
|
46
|
+
|
|
47
|
+
1. Compile Ada source code to Z80 assembly/machine code
|
|
48
|
+
2. Generate CP/M .COM executables
|
|
49
|
+
3. Pass ACATS test suite (or as many tests as feasible for Z80/CP/M)
|
|
50
|
+
4. Generate efficient code suitable for CP/M systems
|
|
51
|
+
5. Provide clear error messages and diagnostics
|
|
52
|
+
|
|
53
|
+
### Inspiration
|
|
54
|
+
|
|
55
|
+
This project builds on experience from [uplm80](https://github.com/yourusername/uplm80), a PL/M-80 compiler for Z80, reusing proven optimization techniques.
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
### Phase 1 (MVP) ✅
|
|
60
|
+
- [x] Project structure
|
|
61
|
+
- [x] Lexer and parser
|
|
62
|
+
- [x] Basic types: Integer, Boolean, Character
|
|
63
|
+
- [x] Procedures and functions
|
|
64
|
+
- [x] Control flow: if, case, loop, for
|
|
65
|
+
- [x] Arrays and records
|
|
66
|
+
- [x] Z80 code generation
|
|
67
|
+
|
|
68
|
+
### Phase 2 (Expanded) ✅
|
|
69
|
+
- [x] Packages
|
|
70
|
+
- [x] Enumeration types
|
|
71
|
+
- [x] Access types (pointers)
|
|
72
|
+
- [x] Derived types
|
|
73
|
+
- [x] Unconstrained arrays
|
|
74
|
+
- [x] AST optimization
|
|
75
|
+
|
|
76
|
+
### Phase 3 (ACATS Compliance) 🔧
|
|
77
|
+
- [x] Generics
|
|
78
|
+
- [x] Exception handling
|
|
79
|
+
- [x] Full attribute support
|
|
80
|
+
- [x] Representation clauses
|
|
81
|
+
- [ ] Standard library (adapted for Z80)
|
|
82
|
+
- [ ] ACATS test validation
|
|
83
|
+
|
|
84
|
+
## Architecture
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Ada Source → Lexer → Parser → AST → Semantic Analysis → Optimizer → Code Gen → Z80 Assembly
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
See [ARCHITECTURE.md](ARCHITECTURE.md) for detailed design documentation.
|
|
91
|
+
|
|
92
|
+
## Building
|
|
93
|
+
|
|
94
|
+
### Requirements
|
|
95
|
+
|
|
96
|
+
- Python 3.10 or later
|
|
97
|
+
- Optional: Z80 assembler (z80asm, sjasmplus, or similar)
|
|
98
|
+
- Optional: Z80 emulator for testing (e.g., MAME, z80emu)
|
|
99
|
+
|
|
100
|
+
### Installation
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Clone the repository
|
|
104
|
+
git clone https://github.com/yourusername/uada80.git
|
|
105
|
+
cd uada80
|
|
106
|
+
|
|
107
|
+
# Create virtual environment
|
|
108
|
+
python3 -m venv venv
|
|
109
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
110
|
+
|
|
111
|
+
# Install in development mode
|
|
112
|
+
pip install -e ".[dev]"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Running Tests
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pytest
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Usage
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Compile an Ada source file
|
|
125
|
+
uada80 hello.ada -o hello.asm
|
|
126
|
+
|
|
127
|
+
# With optimization
|
|
128
|
+
uada80 hello.ada -o hello.asm -O2
|
|
129
|
+
|
|
130
|
+
# Generate listing
|
|
131
|
+
uada80 hello.ada -o hello.asm --listing
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Example Programs
|
|
135
|
+
|
|
136
|
+
### Hello World
|
|
137
|
+
|
|
138
|
+
```ada
|
|
139
|
+
with Ada.Text_IO;
|
|
140
|
+
|
|
141
|
+
procedure Hello is
|
|
142
|
+
begin
|
|
143
|
+
Ada.Text_IO.Put_Line("Hello from Ada on Z80!");
|
|
144
|
+
end Hello;
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Fibonacci
|
|
148
|
+
|
|
149
|
+
```ada
|
|
150
|
+
procedure Fibonacci is
|
|
151
|
+
A, B, Temp : Integer;
|
|
152
|
+
N : Integer := 10;
|
|
153
|
+
begin
|
|
154
|
+
A := 0;
|
|
155
|
+
B := 1;
|
|
156
|
+
|
|
157
|
+
for I in 1 .. N loop
|
|
158
|
+
Temp := A + B;
|
|
159
|
+
A := B;
|
|
160
|
+
B := Temp;
|
|
161
|
+
end loop;
|
|
162
|
+
end Fibonacci;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
See [examples/](examples/) for more examples.
|
|
166
|
+
|
|
167
|
+
## Documentation
|
|
168
|
+
|
|
169
|
+
### Compiler Documentation
|
|
170
|
+
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) - Compiler architecture and design
|
|
171
|
+
- [docs/AST_DESIGN.md](docs/AST_DESIGN.md) - Abstract syntax tree structure
|
|
172
|
+
- [docs/OPTIMIZATION_ANALYSIS.md](docs/OPTIMIZATION_ANALYSIS.md) - Optimization strategies
|
|
173
|
+
- [docs/LANGUAGE_SUBSET.md](docs/LANGUAGE_SUBSET.md) - Supported Ada language features
|
|
174
|
+
|
|
175
|
+
### CP/M Target Platform
|
|
176
|
+
- [docs/CPM_RUNTIME.md](docs/CPM_RUNTIME.md) - **Complete Ada/CP/M runtime specification**
|
|
177
|
+
- [docs/CPM_QUICK_REFERENCE.md](docs/CPM_QUICK_REFERENCE.md) - **CP/M quick reference for developers**
|
|
178
|
+
- [docs/cpm22_bdos_calls.pdf](docs/cpm22_bdos_calls.pdf) - BDOS system call reference
|
|
179
|
+
- [docs/cpm22_bios_calls.pdf](docs/cpm22_bios_calls.pdf) - BIOS hardware interface
|
|
180
|
+
- [docs/cpm22_memory_layout.pdf](docs/cpm22_memory_layout.pdf) - CP/M memory organization
|
|
181
|
+
|
|
182
|
+
### Ada Language Specifications
|
|
183
|
+
- [specs/](specs/) - Ada language specifications and ACATS tests
|
|
184
|
+
|
|
185
|
+
## ACATS Testing
|
|
186
|
+
|
|
187
|
+
The Ada Conformity Assessment Test Suite is included in [acats/](acats/).
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Run ACATS tests (when implemented)
|
|
191
|
+
python tests/run_acats.py
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Limitations
|
|
195
|
+
|
|
196
|
+
Due to the Z80's 8-bit architecture and limited resources:
|
|
197
|
+
|
|
198
|
+
- No floating-point arithmetic (unless software implementation)
|
|
199
|
+
- Integer sizes limited to 8-bit and 16-bit
|
|
200
|
+
- Reduced standard library
|
|
201
|
+
- Tasking support limited or unavailable
|
|
202
|
+
- Limited heap (small memory space)
|
|
203
|
+
|
|
204
|
+
## Contributing
|
|
205
|
+
|
|
206
|
+
Contributions are welcome! Please:
|
|
207
|
+
|
|
208
|
+
1. Fork the repository
|
|
209
|
+
2. Create a feature branch
|
|
210
|
+
3. Make your changes with tests
|
|
211
|
+
4. Run the test suite
|
|
212
|
+
5. Submit a pull request
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
This project is licensed under the GNU General Public License v2.0 - see LICENSE for details.
|
|
217
|
+
|
|
218
|
+
## References
|
|
219
|
+
|
|
220
|
+
- [Ada Reference Manual (Ada 2012)](https://www.adaic.org/resources/add_content/standards/12rm/RM-Final.pdf)
|
|
221
|
+
- [ACATS Test Suite](http://www.ada-auth.org/acats.html)
|
|
222
|
+
- [Z80 CPU User Manual](http://www.z80.info/zip/z80cpu_um.pdf)
|
|
223
|
+
- [uplm80 - PL/M Compiler](https://github.com/yourusername/uplm80)
|
|
224
|
+
|
|
225
|
+
## Related Projects
|
|
226
|
+
|
|
227
|
+
- [GNAT](https://www.adacore.com/gnatpro) - Production Ada compiler
|
|
228
|
+
- [AVR-Ada](https://avr-ada.sourceforge.net/) - Ada for AVR microcontrollers
|
|
229
|
+
- [cc65](https://cc65.github.io/) - C compiler for 6502
|
|
230
|
+
|
|
231
|
+
## Acknowledgments
|
|
232
|
+
|
|
233
|
+
- The Ada programming language community
|
|
234
|
+
- The Z80 retrocomputing community
|
|
235
|
+
- ANTLR parser generator team
|
|
236
|
+
- uplm80 optimization techniques
|
|
237
|
+
|
|
238
|
+
## Status Updates
|
|
239
|
+
|
|
240
|
+
See [CHANGELOG.md](CHANGELOG.md) for development progress.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
**Note**: This is an educational and hobbyist project. For production Ada development, please use [GNAT](https://www.adacore.com/gnatpro) or other mature Ada compilers.
|
uada80-0.2.0/README.md
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# uada80 - Ada Compiler for Z80/CP/M
|
|
2
|
+
|
|
3
|
+
An Ada compiler targeting the Z80 processor and CP/M 2.2 operating system, aiming for ACATS (Ada Conformity Assessment Test Suite) compliance.
|
|
4
|
+
|
|
5
|
+
## Project Status
|
|
6
|
+
|
|
7
|
+
🔧 **Alpha** - Core compiler functionality implemented
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
uada80 is a compiler for the Ada programming language that generates code for the Z80 8-bit microprocessor running CP/M 2.2. The project aims to support a substantial subset of Ada 2012 and pass the ACATS conformance tests.
|
|
12
|
+
|
|
13
|
+
**Target Platform**: CP/M 2.2 on Z80
|
|
14
|
+
- Programs load at 0x0100
|
|
15
|
+
- Access to CP/M BDOS for file I/O and console operations
|
|
16
|
+
- Approximately 57K TPA on typical 64K system
|
|
17
|
+
|
|
18
|
+
### Goals
|
|
19
|
+
|
|
20
|
+
1. Compile Ada source code to Z80 assembly/machine code
|
|
21
|
+
2. Generate CP/M .COM executables
|
|
22
|
+
3. Pass ACATS test suite (or as many tests as feasible for Z80/CP/M)
|
|
23
|
+
4. Generate efficient code suitable for CP/M systems
|
|
24
|
+
5. Provide clear error messages and diagnostics
|
|
25
|
+
|
|
26
|
+
### Inspiration
|
|
27
|
+
|
|
28
|
+
This project builds on experience from [uplm80](https://github.com/yourusername/uplm80), a PL/M-80 compiler for Z80, reusing proven optimization techniques.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
### Phase 1 (MVP) ✅
|
|
33
|
+
- [x] Project structure
|
|
34
|
+
- [x] Lexer and parser
|
|
35
|
+
- [x] Basic types: Integer, Boolean, Character
|
|
36
|
+
- [x] Procedures and functions
|
|
37
|
+
- [x] Control flow: if, case, loop, for
|
|
38
|
+
- [x] Arrays and records
|
|
39
|
+
- [x] Z80 code generation
|
|
40
|
+
|
|
41
|
+
### Phase 2 (Expanded) ✅
|
|
42
|
+
- [x] Packages
|
|
43
|
+
- [x] Enumeration types
|
|
44
|
+
- [x] Access types (pointers)
|
|
45
|
+
- [x] Derived types
|
|
46
|
+
- [x] Unconstrained arrays
|
|
47
|
+
- [x] AST optimization
|
|
48
|
+
|
|
49
|
+
### Phase 3 (ACATS Compliance) 🔧
|
|
50
|
+
- [x] Generics
|
|
51
|
+
- [x] Exception handling
|
|
52
|
+
- [x] Full attribute support
|
|
53
|
+
- [x] Representation clauses
|
|
54
|
+
- [ ] Standard library (adapted for Z80)
|
|
55
|
+
- [ ] ACATS test validation
|
|
56
|
+
|
|
57
|
+
## Architecture
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
Ada Source → Lexer → Parser → AST → Semantic Analysis → Optimizer → Code Gen → Z80 Assembly
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
See [ARCHITECTURE.md](ARCHITECTURE.md) for detailed design documentation.
|
|
64
|
+
|
|
65
|
+
## Building
|
|
66
|
+
|
|
67
|
+
### Requirements
|
|
68
|
+
|
|
69
|
+
- Python 3.10 or later
|
|
70
|
+
- Optional: Z80 assembler (z80asm, sjasmplus, or similar)
|
|
71
|
+
- Optional: Z80 emulator for testing (e.g., MAME, z80emu)
|
|
72
|
+
|
|
73
|
+
### Installation
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Clone the repository
|
|
77
|
+
git clone https://github.com/yourusername/uada80.git
|
|
78
|
+
cd uada80
|
|
79
|
+
|
|
80
|
+
# Create virtual environment
|
|
81
|
+
python3 -m venv venv
|
|
82
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
83
|
+
|
|
84
|
+
# Install in development mode
|
|
85
|
+
pip install -e ".[dev]"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Running Tests
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pytest
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Compile an Ada source file
|
|
98
|
+
uada80 hello.ada -o hello.asm
|
|
99
|
+
|
|
100
|
+
# With optimization
|
|
101
|
+
uada80 hello.ada -o hello.asm -O2
|
|
102
|
+
|
|
103
|
+
# Generate listing
|
|
104
|
+
uada80 hello.ada -o hello.asm --listing
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Example Programs
|
|
108
|
+
|
|
109
|
+
### Hello World
|
|
110
|
+
|
|
111
|
+
```ada
|
|
112
|
+
with Ada.Text_IO;
|
|
113
|
+
|
|
114
|
+
procedure Hello is
|
|
115
|
+
begin
|
|
116
|
+
Ada.Text_IO.Put_Line("Hello from Ada on Z80!");
|
|
117
|
+
end Hello;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Fibonacci
|
|
121
|
+
|
|
122
|
+
```ada
|
|
123
|
+
procedure Fibonacci is
|
|
124
|
+
A, B, Temp : Integer;
|
|
125
|
+
N : Integer := 10;
|
|
126
|
+
begin
|
|
127
|
+
A := 0;
|
|
128
|
+
B := 1;
|
|
129
|
+
|
|
130
|
+
for I in 1 .. N loop
|
|
131
|
+
Temp := A + B;
|
|
132
|
+
A := B;
|
|
133
|
+
B := Temp;
|
|
134
|
+
end loop;
|
|
135
|
+
end Fibonacci;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
See [examples/](examples/) for more examples.
|
|
139
|
+
|
|
140
|
+
## Documentation
|
|
141
|
+
|
|
142
|
+
### Compiler Documentation
|
|
143
|
+
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) - Compiler architecture and design
|
|
144
|
+
- [docs/AST_DESIGN.md](docs/AST_DESIGN.md) - Abstract syntax tree structure
|
|
145
|
+
- [docs/OPTIMIZATION_ANALYSIS.md](docs/OPTIMIZATION_ANALYSIS.md) - Optimization strategies
|
|
146
|
+
- [docs/LANGUAGE_SUBSET.md](docs/LANGUAGE_SUBSET.md) - Supported Ada language features
|
|
147
|
+
|
|
148
|
+
### CP/M Target Platform
|
|
149
|
+
- [docs/CPM_RUNTIME.md](docs/CPM_RUNTIME.md) - **Complete Ada/CP/M runtime specification**
|
|
150
|
+
- [docs/CPM_QUICK_REFERENCE.md](docs/CPM_QUICK_REFERENCE.md) - **CP/M quick reference for developers**
|
|
151
|
+
- [docs/cpm22_bdos_calls.pdf](docs/cpm22_bdos_calls.pdf) - BDOS system call reference
|
|
152
|
+
- [docs/cpm22_bios_calls.pdf](docs/cpm22_bios_calls.pdf) - BIOS hardware interface
|
|
153
|
+
- [docs/cpm22_memory_layout.pdf](docs/cpm22_memory_layout.pdf) - CP/M memory organization
|
|
154
|
+
|
|
155
|
+
### Ada Language Specifications
|
|
156
|
+
- [specs/](specs/) - Ada language specifications and ACATS tests
|
|
157
|
+
|
|
158
|
+
## ACATS Testing
|
|
159
|
+
|
|
160
|
+
The Ada Conformity Assessment Test Suite is included in [acats/](acats/).
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Run ACATS tests (when implemented)
|
|
164
|
+
python tests/run_acats.py
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Limitations
|
|
168
|
+
|
|
169
|
+
Due to the Z80's 8-bit architecture and limited resources:
|
|
170
|
+
|
|
171
|
+
- No floating-point arithmetic (unless software implementation)
|
|
172
|
+
- Integer sizes limited to 8-bit and 16-bit
|
|
173
|
+
- Reduced standard library
|
|
174
|
+
- Tasking support limited or unavailable
|
|
175
|
+
- Limited heap (small memory space)
|
|
176
|
+
|
|
177
|
+
## Contributing
|
|
178
|
+
|
|
179
|
+
Contributions are welcome! Please:
|
|
180
|
+
|
|
181
|
+
1. Fork the repository
|
|
182
|
+
2. Create a feature branch
|
|
183
|
+
3. Make your changes with tests
|
|
184
|
+
4. Run the test suite
|
|
185
|
+
5. Submit a pull request
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
This project is licensed under the GNU General Public License v2.0 - see LICENSE for details.
|
|
190
|
+
|
|
191
|
+
## References
|
|
192
|
+
|
|
193
|
+
- [Ada Reference Manual (Ada 2012)](https://www.adaic.org/resources/add_content/standards/12rm/RM-Final.pdf)
|
|
194
|
+
- [ACATS Test Suite](http://www.ada-auth.org/acats.html)
|
|
195
|
+
- [Z80 CPU User Manual](http://www.z80.info/zip/z80cpu_um.pdf)
|
|
196
|
+
- [uplm80 - PL/M Compiler](https://github.com/yourusername/uplm80)
|
|
197
|
+
|
|
198
|
+
## Related Projects
|
|
199
|
+
|
|
200
|
+
- [GNAT](https://www.adacore.com/gnatpro) - Production Ada compiler
|
|
201
|
+
- [AVR-Ada](https://avr-ada.sourceforge.net/) - Ada for AVR microcontrollers
|
|
202
|
+
- [cc65](https://cc65.github.io/) - C compiler for 6502
|
|
203
|
+
|
|
204
|
+
## Acknowledgments
|
|
205
|
+
|
|
206
|
+
- The Ada programming language community
|
|
207
|
+
- The Z80 retrocomputing community
|
|
208
|
+
- ANTLR parser generator team
|
|
209
|
+
- uplm80 optimization techniques
|
|
210
|
+
|
|
211
|
+
## Status Updates
|
|
212
|
+
|
|
213
|
+
See [CHANGELOG.md](CHANGELOG.md) for development progress.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
**Note**: This is an educational and hobbyist project. For production Ada development, please use [GNAT](https://www.adacore.com/gnatpro) or other mature Ada compilers.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "uada80"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Ada compiler targeting Z80 processor"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "GPLv2"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "uada80 project"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ada", "compiler", "z80", "retro", "embedded"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Software Development :: Compilers",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
dependencies = [
|
|
28
|
+
"upeepz80>=0.1.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = [
|
|
33
|
+
"pytest>=7.4.0",
|
|
34
|
+
"pytest-cov>=4.1.0",
|
|
35
|
+
"mypy>=1.5.0",
|
|
36
|
+
"black>=23.7.0",
|
|
37
|
+
"ruff>=0.0.285",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.scripts]
|
|
41
|
+
uada80 = "uada80.main:main"
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
Homepage = "https://github.com/avwohl/uada80"
|
|
45
|
+
Repository = "https://github.com/avwohl/uada80"
|
|
46
|
+
|
|
47
|
+
[tool.setuptools.packages.find]
|
|
48
|
+
where = ["."]
|
|
49
|
+
include = ["uada80*"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
testpaths = ["tests"]
|
|
53
|
+
python_files = ["test_*.py"]
|
|
54
|
+
python_classes = ["Test*"]
|
|
55
|
+
python_functions = ["test_*"]
|
|
56
|
+
addopts = [
|
|
57
|
+
"--verbose",
|
|
58
|
+
"--cov=uada80",
|
|
59
|
+
"--cov-report=term-missing",
|
|
60
|
+
"--cov-report=html",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[tool.mypy]
|
|
64
|
+
python_version = "3.10"
|
|
65
|
+
warn_return_any = true
|
|
66
|
+
warn_unused_configs = true
|
|
67
|
+
disallow_untyped_defs = true
|
|
68
|
+
disallow_incomplete_defs = true
|
|
69
|
+
check_untyped_defs = true
|
|
70
|
+
no_implicit_optional = true
|
|
71
|
+
warn_redundant_casts = true
|
|
72
|
+
warn_unused_ignores = true
|
|
73
|
+
warn_no_return = true
|
|
74
|
+
strict_equality = true
|
|
75
|
+
|
|
76
|
+
[tool.black]
|
|
77
|
+
line-length = 100
|
|
78
|
+
target-version = ['py310']
|
|
79
|
+
include = '\.pyi?$'
|
|
80
|
+
|
|
81
|
+
[tool.ruff]
|
|
82
|
+
line-length = 100
|
|
83
|
+
target-version = "py310"
|
|
84
|
+
select = [
|
|
85
|
+
"E", # pycodestyle errors
|
|
86
|
+
"W", # pycodestyle warnings
|
|
87
|
+
"F", # pyflakes
|
|
88
|
+
"I", # isort
|
|
89
|
+
"N", # pep8-naming
|
|
90
|
+
"UP", # pyupgrade
|
|
91
|
+
"B", # flake8-bugbear
|
|
92
|
+
"C4", # flake8-comprehensions
|
|
93
|
+
]
|
|
94
|
+
ignore = [
|
|
95
|
+
"E501", # line too long (handled by black)
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
[tool.ruff.per-file-ignores]
|
|
99
|
+
"__init__.py" = ["F401"]
|
|
100
|
+
"tests/*.py" = ["N802", "N806"]
|
uada80-0.2.0/setup.cfg
ADDED