How servostar/gemstone works
Main Components
a) Compiler Pipeline Components:
• Lexical Analysis (using Flex)
• Syntax Analysis (using Bison)
• Semantic Analysis
• LLVM Code Generation
• Linking System (Clang/GCC)
b) Supporting Systems:
• Build System (CMake-based)
• Standard Library Components
• Testing Framework
• Docker Infrastructure
Detailed Component Breakdown
Layer 1 - Core Compiler Pipeline:
[Source Files] -> [Lexer (Flex)] -> [Parser (Bison)] -> [AST Generator] -> [LLVM IR Generator] -> [Backend (LLVM)] -> [Linker (Clang/GCC)]
Layer 2 - Standard Library System:
[lib/
• math
• io
• os
• mem
• std]
Layer 3 - Build & Testing Infrastructure:
[Docker Containers] -> [CMake Build System] -> [Test Suite]
Specific Implementation Details
a) Component Interactions:
• How the AST is built and transformed
• Import/include resolution process
• Demonstrate the library/executable output paths
b) Build Pipeline:
• Docker container hierarchy (Alpine -> SDK -> Devkit)
• CMake configuration flow
• Test integration points
Key Architectural Elements to Highlight
• Non-reentrant compiler design
• Linear flow of components
• LALR parsing capability
• Cross-compilation support
• Standard library integration
• Docker-based build isolation
Create distinct sections for:
Additional Notes
• Annotations for important configuration files
• Relationship between the build system and compiler components
• Where optimization passes occur
• Entry points for different build targets (library vs. executable)
This architecture should be represented as a combination of:
Each of these can be separate but interconnected views of the same system, providing a complete picture of the Gemstone compiler's architecture.