Hi everyone,
I've been working on a compiler hobby project called Ion+. The project explores combining low-level systems programming concepts (typed variables, manual memory handling, hardware-level control) with a clean, indentation-based syntax.
The entire compiler frontend is written from scratch in Python to keep the pipeline clear, modular, and accessible before targeting an LLVM backend.
What the Syntax Looks Like
struct Node:
int node_id
ptr char ip_address
bool is_active
byte latency
const unsigned int MAX_RETRIES = 5
alloc ptr buffer = addr MAX_RETRIES
?int Node.connect():
if not network_ready:
return none
int attempts = 0
while attempts < MAX_RETRIES:
if hardware.ping() == True:
return 1
attempts += 1
return 0
Current Pipeline & Implementation
The compiler frontend currently covers stages 1 through 4:
-
Lexing & Scanning: Regex-based tokenizer identifying keywords, types (
int,byte,ptr,none), modifiers (const,volatile,atomic,alloc), operators, and literals. -
Indentation Handling: Post-lexer stream processor that tracks indentation depth and automatically injects explicit
INDENTandDEDENTtokens for block boundaries. -
AST Construction: Explicit node definitions (
nodes.py) representing program structures, typed variable declarations, member/call expressions, conditionals, and loops. -
Parser: Recursive descent parser (
core_parser.py) converting token streams into a structured AST ready for semantic analysis.
What You Can Test Right Now
- Parsing source files directly using the
.ionxextension. - Inspecting token streams and generated AST structures via
main.py. - Experimenting with typed variable declarations, structs, and control-flow blocks.
Looking for Contributors & Feedback
Ion+ is open source and licensed under the MIT License.
Contributions, feedback, and discussions are welcome across multiple areas:
- Improving parser rules and grammar edge-case handling.
- Expanding AST node definitions.
- Planning symbol tables, type checking, and semantic validation passes.
- Preparing the foundation for LLVM IR code generation.
Writing test cases and improving documentation.
Repository: https://github.com/YashAryaPersonal/ion-plus
Web Preview: https://ion-plus-preview.onrender.com/
License: MIT
Feel free to check out the repository, try the code, open issues, or share your thoughts!
Top comments (0)