Oker is a custom interpreted programming language designed with human-readable syntax and comprehensive language features.
The project consists of a C++ compiler/interpreter backend with a web-based frontend interface for interactive development and testing.
- Language: C++17
- Build System: CMake
- Architecture: Traditional compiler pipeline with interpreter
- Components:
Lexer → Parser → Semantic Analyzer → Code Generator → Virtual Machine
- Technology: Vanilla JavaScript with HTML/CSS
- Server: Python HTTP server for API endpoints
- Interface: Single-page application with real-time compilation
- Natural language-like syntax (
say,let,if,while,repeat) - Object-oriented programming with classes
- Error handling with
try/failblocks - File I/O operations
- Built-in functions and type system
- Lexer (
src/lexer.cpp/.h): Tokenizes source code into language tokens - Parser (
src/parser.cpp/.h): Builds Abstract Syntax Tree (AST) from tokens - Semantic Analyzer (
src/semantic.cpp/.h): Type checking and semantic validation - Code Generator (
src/codegen.cpp/.h): Generates bytecode from AST - Virtual Machine (
src/vm.cpp/.h): Executes generated bytecode - Built-ins (
src/builtins.cpp/.h): Standard library functions
- Frontend (
web/app.js): Interactive code editor with compilation features - HTTP Server (
web/server.py): REST API for compilation requests - UI (
web/index.html,web/style.css): Modern web interface with syntax highlighting
- Unit tests for all compiler components
- Test files for lexer, parser, semantic analysis, and code generation
- CMake-integrated testing framework
- Source Code Input: User writes Oker code in web interface
- Tokenization: Lexer breaks code into tokens
- Parsing: Parser constructs AST from tokens
- Semantic Analysis: Validates types and semantics
- Code Generation: Produces bytecode instructions
- Execution: Virtual machine interprets bytecode
- Output: Results displayed in web interface
- User submits code via web interface
- JavaScript sends
POSTrequest to Python server - Python server invokes C++ compiler binary
- Compilation results returned as JSON
- Frontend displays output, tokens, AST, or bytecode
- CMake (3.16+)
- C++17 compatible compiler
- Python 3 (for web server)
- Address sanitizer for debugging
- Comprehensive compiler flags for code quality
- Testing framework integration
- Font Awesome icons
- Modern web browser with ES6 support
- No external JavaScript frameworks (vanilla JS approach)
- CMake build system for cross-platform compilation
- Debug builds with sanitizers for development
- Release builds with optimization for production
- Simple Python HTTP server for development
- Static file serving for HTML/CSS/JS
- RESTful API for compilation requests
- Unit tests for all compiler components
- Integration tests through web interface
- Automated testing via CMake
Preferred communication style: Simple, everyday language.
- July 08, 2025: Fixed compilation errors in
SymbolandFunctionstructs by adding default constructors - July 08, 2025: Fixed missing
<cmath>include in VM for modulo operations - July 08, 2025: Successfully built Oker compiler binary with full functionality
- July 08, 2025: Set up web interface with Python HTTP server on port 5000
- July 08, 2025: Fixed comment parsing issue - tilde comments not properly implemented in lexer
- July 08, 2025: Verified all core language features working: variables, functions, math operations, string operations
- July 08, 2025: MAJOR BREAKTHROUGH - Fixed function declarations and jump resolution completely
- July 08, 2025: Fixed string concatenation type system to allow mixed string/non-string operations
- July 08, 2025: All critical compiler issues resolved - comments, functions, expressions, blocks, conditionals, loops all working
✅ Compiler builds successfully and generates working executable
✅ Web interface operational with code editor and compilation features
✅ Core language features functional: variables, arithmetic, strings, functions
✅ Built-in functions implemented: str(), len(), upper(), lower()
✅ Example programs working correctly
✅ Comments (~) parsing and handling completely functional
✅ Function declarations (makef) with parameters working perfectly
✅ String concatenation with mixed types working
✅ Control structures (if/else, while, repeat) fully operational
✅ All compiler phases working: lexer, parser, semantic analyzer, code generator, VM
- Test suite has multiple definition errors (tests still functional individually)
- All core language features are now fully functional
July 08, 2025 — Initial setup and complete implementation