Zero Language Support
A Visual Studio Code extension for testing and running Zero programming language - a custom language created for self-learning compiler development.
📚 About This Project
This extension is designed to test a self-written compiler for the Zero programming language. Zero is a simple C-like language created as a learning exercise to understand:
- Lexical analysis and parsing
- Abstract syntax tree (AST) construction
- Semantic analysis and type checking
- Code generation and compilation techniques
- Language tooling integration
🔧 Language Features
Zero is a minimalistic programming language with:
- Data Types:
int
(int32
), double
, bool
, ...
- Control Flow:
if-else
statements, while
loops
- Functions: User-defined functions with parameters and return values
- Built-in Function: Only
printf()
is provided as an external function
- C-like Syntax: Familiar syntax for ease of learning
📝 Example Code
Here's a sample Zero program (main.zr
):
// main function
int main()
{
int32 sum = Sum(1, 100);
double pi = 3.1415926;
printf("Result is %d.\n", sum);
printf("Result is %d - 1.\n", PlusOne(sum));
printf("Pi is %f\n", pi);
bool b = true;
if (b)
{
printf("true");
}
else printf("false");
return 0;
}
int PlusOne(int x)
{
x += 1;
return x;
}
int Sum(int start, int end)
{
int sum = 0;
while (!(start > end))
{
sum += start;
start += 1;
}
return sum;
}
✨ Extension Features
- File Association: Automatically recognizes
.zr
files as Zero language files
- One-Click Execution: Run Zero programs directly from VS Code
- Terminal Integration: Execute programs in VS Code's integrated terminal
- Keyboard Shortcuts: Press
Ctrl+F5
to quickly run your programs
🚀 Getting Started
Prerequisites
- Visual Studio Code
- The Zero compiler (
zeror.exe
) is bundled with this extension
Usage
- Create a new file with
.zr
extension (e.g., main.zr
)
- Write your Zero program (see example above)
- Click the ▶️ Run button in the editor toolbar, or
- Press
Ctrl+F5
, or
- Right-click and select "Run Zero File"
The program will execute in VS Code's integrated terminal.
🎯 Compiler Testing
This extension serves as a practical testing environment for the Zero compiler, allowing you to:
- Write test programs quickly
- Execute them with a single click
- View compilation errors and runtime output
- Iterate on compiler improvements efficiently
⚠️ Educational Purpose
Important Note: This is an educational project created for learning compiler development. The Zero language and its compiler are experimental tools designed for:
- Understanding compilation processes
- Testing language design concepts
- Exploring compiler optimization techniques
This is not intended for production use but rather as a practical learning platform.
🛠️ Language Limitations
Currently, Zero language has intentional limitations to keep the compiler implementation focused:
- Single built-in function: Only
printf()
is available for output
- No standard library: Minimal runtime environment
- Basic type system: Simple data types only
- No advanced features: No classes, modules, or complex data structures
📄 License
This project is developed for educational purposes as part of compiler development studies.
🎓 Learning Resources
This extension demonstrates practical implementation of:
- Language server protocol concepts
- VS Code extension development
- Compiler testing workflows
- IDE integration for custom languages
Perfect for compiler enthusiasts and language design learners! 🚀