How nihirash/bsimple-ez80-compiler works
B Simple is a typeless, B-inspired compiled language targeting eZ80 assembly. Its main workflow reads a .bs program, scans and processes it, and writes an assembly listing for the external ez80asm assembler to turn into a runnable binary. The documented bs tool can concatenate sources and run the compiler and assembler as a single build workflow. Libraries extend programs with standard routines, file access, printing, and arcade features. The compiler excerpts support the front-end and output relationships shown; unsampled library wiring is not inferred.
Main entry points: main.c Compiler entry · scanner.c Statement processing · writer.c Assembly writer · reader.c Source reader
Components 19
Compiler
- Compiler entry
compiler/src/main.c - Source reader
compiler/src/reader.c - Tokenization
compiler/src/token.c - Statement processing
compiler/src/scanner.c - Symbol table
compiler/src/symbols.c - Assembly generation
compiler/src/generator.c - Assembly writer
compiler/src/writer.c - Error reporting
compiler/src/errors.c
Libraries
- Standard library
lib/stdlib - Runtime startup
lib/startup - MOS runtime
lib/moslet - File routines
lib/files - Printer routines
lib/printer - Arcade features
lib/arcade
Build tools
- Source build tool
native-tools/bs.bs
Program outputs
- Assembly listing
- Runnable binary
Other components
- Programmer
- ez80asm
Connections 19
- Programmer → Source build tool: builds with
- Programmer → Compiler entry: compiles with
- Source build tool → Compiler entry: invokes
- Source build tool → ez80asm: invokes
- Compiler entry → Source reader: initializes input
- Compiler entry → Assembly writer: initializes output
- Compiler entry → Statement processing: processes program
- Tokenization → Source reader: reads characters
- Statement processing → Tokenization: requests tokens
- Statement processing → Symbol table: looks up names
- Statement processing → Assembly generation: emits operations
- Statement processing → Source reader: includes sources
- Assembly generation → Assembly writer: writes assembly
- Compiler entry → Assembly writer: closes output
- Error reporting → Source reader: reports location
- Error reporting → Assembly writer: closes output
- Assembly writer → Assembly listing: produces
- Assembly listing → ez80asm: assembled by
- ez80asm → Runnable binary: produces