
Argonaut is a procedural programming language designed for educational purposes, featuring a compiler and virtual machine implemented in C. This project aims to provide a comprehensive understanding of how compilers and interpreters function.
Important
Checkout wiki documentation to understand how the Argonaut compiler and vm works.
Before you begin, ensure you have the following installed:
- C Compiler: gcc
- Lexical Analyzer: flex
- Parser Generator: bison
- Documentation Generator: doxygen (optional)
- Debugger: gdb (optional)
git clone https://github.com/zestones/Argonaut.git
cd Argonaut
# Build compiler and VM
make
The executable files will be generated in the bin
directory. argoc
stand for Argonaut compiler and argov
stand for Argonaut virtual machine.
You can also install the VSCode extension for Argonaut to higlight the Argonaut language.
make extension-install
To delete the VSCode extension, run make extension-uninstall
.
- Compiler: Run :
Use ./
./bin/argoc -a <source-file> -o <output-file>
./bin/argov --help
for more options. - Virtual Machine: Run :
Use
./bin/argov βa <intermediate-file>
./bin/argov βh
for more options.
Checkout the Argonaut Language Guide documentation to write your own programs in Argonaut.
func fibonacci(num : int) -> int {
if (num <= 1) { return num; }
return fibonacci(num - 1) + fibonacci(num - 2);
}
proc main() {
var num : int;
print("Enter a number: ");
input("%d", num);
print("fibonacci(%d) = %d\n", num, fibonacci(num));
}
main();
Note
Example programs are provided in the examples/interpretation/functional/
directory.
I'll organize both the implemented and missing features by categories:
- Primitive types (int, float, char, bool)
- Basic string support (print-only)
- Arrays with custom ranges
- Multidimensional arrays
- Struct types
- Variable declaration with explicit typing
- String manipulation functions
- Constants/immutable variables
- Pointers/references
- Arithmetic (+, -, *, /, %)
- Comparison (==, !=, <, >, <=, >=)
- Logical (&&, ||, !)
- Assignment (:=)
- Increment/decrement operators (++, --)
- Compound assignment operators (+=, -=, etc.)
- Ternary operator
- If-else, else-if conditionals
- While loops
- For loops
- Break and continue
- Return statement
- Switch/case statements
- Do-while loops
- Functions with return values (only basic return types)
- Procedures (void functions)
- Parameters and arguments
- Nested functions
- Scope rules
- Function overloading
- Basic console output (print)
- Basic input reading
- Format specifiers (%d, %f, %c, %s)
- File I/O
- Single-line comments (//)
- Multi-line comments
.
βββ bin/ # Compiled binaries
βββ docs/ # Generated documentation
βββ extensions/ # Custom extensions (for Argonaut syntax highlighting)
βββ examples/ # Sample programs
β βββ compilation/ # Compiler examples
β βββ interpretation/ # Interpreter examples
βββ lib/ # Utility libraries (colors, and table formatting)
βββ src/ # Core implementation
βββ tests/ # Regression tests
We welcome contributions from the community! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with descriptive messages.
- Push your branch to your fork.
- Submit a pull request to the main repository.
For detailed documentation, including language syntax, compiler architecture, and virtual machine specifications, please visit the Wiki.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ by the Argonaut Contributors
π Project Repository | π Documentation | π Report a Bug