Projektrahmen: Cargo-Workspace, README und PLAN
Workspace mit sechs Crates (tb-frontend, tb-vm, tb-runtime, tb-ui, tb-cli, tb-ide) als Geruest fuer die Re-Implementierung des DOS-BASIC-Dialekts. Binaries: tbdos (IDE/TUI) und tbdosc (Standalone-Compiler). PLAN.md dokumentiert Phasen, Explorations- schritte und die Abwaegung der VM-/Runtime-Optionen (Entscheidung: eigene Bytecode-VM, TBVM). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
18
crates/tb-cli/Cargo.toml
Normal file
18
crates/tb-cli/Cargo.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "tb-cli"
|
||||
description = "Terminal Basic: Standalone-Kommandozeilen-Compiler (tbdosc)"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "tbdosc"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
tb-frontend.workspace = true
|
||||
tb-vm.workspace = true
|
||||
tb-runtime.workspace = true
|
||||
tb-ui.workspace = true
|
||||
anyhow.workspace = true
|
||||
13
crates/tb-cli/src/main.rs
Normal file
13
crates/tb-cli/src/main.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
//! `tbdosc` — Standalone-Compiler von Terminal Basic.
|
||||
//!
|
||||
//! Wandelt Quelldateien und Projekte in binäre Ergebnisse (`.tbc`-Bytecode
|
||||
//! bzw. eigenständig ausführbare Programme) um. Geplante Unterbefehle
|
||||
//! (siehe PLAN.md):
|
||||
//! - `tbdosc build <projekt|datei.bas>` Kompilieren zu binärem Ergebnis
|
||||
//! - `tbdosc run <datei.bas>` Kompilieren und sofort ausführen
|
||||
//! - `tbdosc check <datei.bas>` Nur Syntax-/Semantikprüfung
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
println!("tbdosc — Terminal Basic Compiler (Projektrahmen, noch ohne Funktion)");
|
||||
Ok(())
|
||||
}
|
||||
11
crates/tb-frontend/Cargo.toml
Normal file
11
crates/tb-frontend/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "tb-frontend"
|
||||
description = "Terminal Basic: Lexer, Parser, AST und semantische Analyse"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[dependencies]
|
||||
thiserror.workspace = true
|
||||
log.workspace = true
|
||||
4
crates/tb-frontend/src/ast.rs
Normal file
4
crates/tb-frontend/src/ast.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
//! AST-Definitionen: Module, Prozeduren (`SUB`/`FUNCTION`), Anweisungen, Ausdrücke,
|
||||
//! benutzerdefinierte Typen (`TYPE … END TYPE`), Deklarationen.
|
||||
|
||||
// Platzhalter — wird in Phase 1 ausgearbeitet (siehe PLAN.md)
|
||||
13
crates/tb-frontend/src/lexer.rs
Normal file
13
crates/tb-frontend/src/lexer.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
//! Lexer: zerlegt Quelltext in Tokens.
|
||||
//!
|
||||
//! Besonderheiten des BASIC-Dialekts, die hier abgebildet werden müssen:
|
||||
//! - Typ-Suffixe an Bezeichnern und Literalen (`%`, `&`, `!`, `#`, `$`, `@`)
|
||||
//! - Zeilennummern und Labels
|
||||
//! - Keywords sind case-insensitiv, der Editor normalisiert später auf Großschreibung
|
||||
//! - Fortsetzung/Trennung von Anweisungen mit `:` und Kommentare mit `'` und `REM`
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Token {
|
||||
// Platzhalter — wird in Phase 1 ausgearbeitet (siehe PLAN.md)
|
||||
Eof,
|
||||
}
|
||||
17
crates/tb-frontend/src/lib.rs
Normal file
17
crates/tb-frontend/src/lib.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
//! Frontend des Terminal-Basic-Compilers.
|
||||
//!
|
||||
//! Enthält Lexer, Parser, AST-Definitionen und die semantische Analyse
|
||||
//! (Symboltabellen, Typprüfung, implizite Deklarationen, `DEFINT`-Regeln usw.).
|
||||
//! Ausgabe des Frontends ist ein typgeprüfter AST bzw. eine Zwischen-
|
||||
//! repräsentation (IR), die von `tb-vm` in Bytecode übersetzt wird.
|
||||
|
||||
pub mod lexer;
|
||||
pub mod parser;
|
||||
pub mod ast;
|
||||
|
||||
/// Quelltextposition für Diagnostik (1-basiert, wie im klassischen IDE-Vorbild).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct SourcePos {
|
||||
pub line: u32,
|
||||
pub column: u32,
|
||||
}
|
||||
6
crates/tb-frontend/src/parser.rs
Normal file
6
crates/tb-frontend/src/parser.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
//! Parser: baut aus dem Tokenstrom den AST.
|
||||
//!
|
||||
//! Der Parser arbeitet zeilenorientiert (eine logische Zeile = eine oder mehrere
|
||||
//! Anweisungen), wie es das IDE-Vorbild mit seiner Zeile-für-Zeile-Prüfung tut.
|
||||
|
||||
// Platzhalter — wird in Phase 1 ausgearbeitet (siehe PLAN.md)
|
||||
20
crates/tb-ide/Cargo.toml
Normal file
20
crates/tb-ide/Cargo.toml
Normal file
@@ -0,0 +1,20 @@
|
||||
[package]
|
||||
name = "tb-ide"
|
||||
description = "Terminal Basic: integrierte Entwicklungsumgebung im Terminal"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "tbdos"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
tb-frontend.workspace = true
|
||||
tb-vm.workspace = true
|
||||
tb-runtime.workspace = true
|
||||
tb-ui.workspace = true
|
||||
ratatui.workspace = true
|
||||
crossterm.workspace = true
|
||||
anyhow.workspace = true
|
||||
11
crates/tb-ide/src/main.rs
Normal file
11
crates/tb-ide/src/main.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
//! `tbdos` — die integrierte Entwicklungsumgebung von Terminal Basic (TUI).
|
||||
//!
|
||||
//! Nachbildung der klassischen DOS-IDE: Menüleiste, Editor mit
|
||||
//! Syntaxprüfung pro Zeile, Formular-Designer, Direktfenster,
|
||||
//! Debugger (Einzelschritt, Breakpoints, Überwachungsausdrücke).
|
||||
//! Siehe PLAN.md, Phase 5.
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
println!("tbdos — Terminal Basic IDE (Projektrahmen, noch ohne Funktion)");
|
||||
Ok(())
|
||||
}
|
||||
11
crates/tb-runtime/Cargo.toml
Normal file
11
crates/tb-runtime/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "tb-runtime"
|
||||
description = "Terminal Basic: Laufzeitbibliothek (Strings, Mathematik, Datei-E/A, Datum/Zeit)"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[dependencies]
|
||||
thiserror.workspace = true
|
||||
log.workspace = true
|
||||
3
crates/tb-runtime/src/datetime.rs
Normal file
3
crates/tb-runtime/src/datetime.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
//! Datums- und Zeitfunktionen der Laufzeitbibliothek.
|
||||
|
||||
// Platzhalter — wird in Phase 3 ausgearbeitet (siehe PLAN.md)
|
||||
4
crates/tb-runtime/src/errors.rs
Normal file
4
crates/tb-runtime/src/errors.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
//! Laufzeitfehler: Codes und Meldungstexte kompatibel zum Vorbild
|
||||
//! (z. B. 6 = Overflow, 9 = Subscript out of range, 53 = File not found).
|
||||
|
||||
// Platzhalter — wird in Phase 3 ausgearbeitet (siehe PLAN.md)
|
||||
3
crates/tb-runtime/src/fileio.rs
Normal file
3
crates/tb-runtime/src/fileio.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
//! Datei-E/A der Laufzeitbibliothek (sequenziell, Random Access, binär).
|
||||
|
||||
// Platzhalter — wird in Phase 3 ausgearbeitet (siehe PLAN.md)
|
||||
11
crates/tb-runtime/src/lib.rs
Normal file
11
crates/tb-runtime/src/lib.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
//! Laufzeitbibliothek von Terminal Basic.
|
||||
//!
|
||||
//! Implementiert die eingebauten Funktionen und Anweisungen des Dialekts,
|
||||
//! gruppiert nach Themen. Ziel ist verhaltensgleiche Nachbildung inklusive
|
||||
//! Rundungs-, Formatierungs- und Fehlerverhalten (siehe PLAN.md, Phase 3).
|
||||
|
||||
pub mod strings; // LEFT$, MID$, INSTR, STR$, VAL, Formatierung mit PRINT USING …
|
||||
pub mod math; // Arithmetik, Rundung (Banker's Rounding), RND/RANDOMIZE …
|
||||
pub mod fileio; // OPEN/CLOSE/PRINT#/INPUT#/GET/PUT, sequenziell/random/binär
|
||||
pub mod datetime; // DATE$, TIME$, TIMER
|
||||
pub mod errors; // Laufzeitfehler-Codes und -Meldungen des Vorbilds
|
||||
3
crates/tb-runtime/src/math.rs
Normal file
3
crates/tb-runtime/src/math.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
//! Mathematische Funktionen der Laufzeitbibliothek.
|
||||
|
||||
// Platzhalter — wird in Phase 3 ausgearbeitet (siehe PLAN.md)
|
||||
3
crates/tb-runtime/src/strings.rs
Normal file
3
crates/tb-runtime/src/strings.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
//! String-Funktionen der Laufzeitbibliothek.
|
||||
|
||||
// Platzhalter — wird in Phase 3 ausgearbeitet (siehe PLAN.md)
|
||||
13
crates/tb-ui/Cargo.toml
Normal file
13
crates/tb-ui/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "tb-ui"
|
||||
description = "Terminal Basic: Bildschirm-Runtime und Forms-Engine auf Ratatui"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[dependencies]
|
||||
ratatui.workspace = true
|
||||
crossterm.workspace = true
|
||||
thiserror.workspace = true
|
||||
log.workspace = true
|
||||
5
crates/tb-ui/src/events.rs
Normal file
5
crates/tb-ui/src/events.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
//! Ereignismodell: Abbildung von Terminal-Ereignissen (crossterm) auf die
|
||||
//! Ereignisse des Dialekts (Click, GotFocus, KeyPress, Load, Unload …)
|
||||
//! und die Ereigniswarteschlange für die VM-Hauptschleife.
|
||||
|
||||
// Platzhalter — wird in Phase 4 ausgearbeitet (siehe PLAN.md)
|
||||
6
crates/tb-ui/src/forms.rs
Normal file
6
crates/tb-ui/src/forms.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
//! Forms-Engine: Formulare, Steuerelemente, Eigenschaften, Methoden.
|
||||
//!
|
||||
//! Ziel ist volle Kompatibilität zum Forms-Modell des Vorbilds inklusive
|
||||
//! des textbasierten Formular-Dateiformats (`.FRM`).
|
||||
|
||||
// Platzhalter — wird in Phase 4 ausgearbeitet (siehe PLAN.md)
|
||||
13
crates/tb-ui/src/lib.rs
Normal file
13
crates/tb-ui/src/lib.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
//! Bildschirm-Runtime und Forms-Engine von Terminal Basic, aufbauend auf Ratatui.
|
||||
//!
|
||||
//! Zwei Schichten:
|
||||
//! 1. `screen`: Emulation des 80×25-Textbildschirms (Codepage 437, 16 Farben,
|
||||
//! Cursor) als Zeichenpuffer, gerendert über Ratatui. Darauf setzen die
|
||||
//! klassischen Anweisungen `PRINT`, `LOCATE`, `COLOR`, `CLS`, `INPUT` auf.
|
||||
//! 2. `forms`: ereignisgesteuerte Forms-Engine — Fenster, Steuerelemente
|
||||
//! (Schaltflächen, Textfelder, Listen …), Menüs, Fokusreihenfolge,
|
||||
//! Tastatur- und Mausereignisse.
|
||||
|
||||
pub mod screen;
|
||||
pub mod forms;
|
||||
pub mod events;
|
||||
4
crates/tb-ui/src/screen.rs
Normal file
4
crates/tb-ui/src/screen.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
//! Textbildschirm-Emulation: Zellenpuffer (Zeichen + Attribut), Cursor,
|
||||
//! Codepage-437-Abbildung auf Unicode, Rendering über Ratatui.
|
||||
|
||||
// Platzhalter — wird in Phase 0/3 ausgearbeitet (siehe PLAN.md)
|
||||
12
crates/tb-vm/Cargo.toml
Normal file
12
crates/tb-vm/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "tb-vm"
|
||||
description = "Terminal Basic: Bytecode-Definition, Codegenerator und virtuelle Maschine"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[dependencies]
|
||||
tb-frontend.workspace = true
|
||||
thiserror.workspace = true
|
||||
log.workspace = true
|
||||
3
crates/tb-vm/src/bytecode.rs
Normal file
3
crates/tb-vm/src/bytecode.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
//! Bytecode-Format der TBVM: Opcodes, Konstantenpool, Modul-/Prozedurtabellen.
|
||||
|
||||
// Platzhalter — wird in Phase 2 ausgearbeitet (siehe PLAN.md)
|
||||
3
crates/tb-vm/src/codegen.rs
Normal file
3
crates/tb-vm/src/codegen.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
//! Codegenerator: übersetzt den typgeprüften AST aus `tb-frontend` in TBVM-Bytecode.
|
||||
|
||||
// Platzhalter — wird in Phase 2 ausgearbeitet (siehe PLAN.md)
|
||||
6
crates/tb-vm/src/interp.rs
Normal file
6
crates/tb-vm/src/interp.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
//! Interpreterschleife der TBVM.
|
||||
//!
|
||||
//! Läuft kooperativ: die Ausführung kann an Anweisungsgrenzen angehalten werden
|
||||
//! (Debugger, Ereignisverarbeitung der Forms-Engine, Strg+Untbr).
|
||||
|
||||
// Platzhalter — wird in Phase 2 ausgearbeitet (siehe PLAN.md)
|
||||
13
crates/tb-vm/src/lib.rs
Normal file
13
crates/tb-vm/src/lib.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
//! Virtuelle Maschine für Terminal Basic (TBVM).
|
||||
//!
|
||||
//! Eigene Stack-basierte Bytecode-VM (Entscheidung siehe PLAN.md, Abschnitt
|
||||
//! „VM-/Runtime-Optionen"). Kernanforderungen:
|
||||
//! - Serialisierbares Bytecode-Format (`.tbc`) als Compiler-Ziel
|
||||
//! - Unterbrechbar/wiederaufnehmbar für Debugger (Einzelschritt, Breakpoints)
|
||||
//! und für die ereignisgesteuerte Forms-Hauptschleife
|
||||
//! - BASIC-Fehlersemantik (`ON ERROR GOTO`, `RESUME`, `ERR`/`ERL`)
|
||||
//! - `GOSUB`/`RETURN` neben regulären Prozeduraufrufen
|
||||
|
||||
pub mod bytecode;
|
||||
pub mod codegen;
|
||||
pub mod interp;
|
||||
Reference in New Issue
Block a user