Skip to content

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.

License

Notifications You must be signed in to change notification settings

zestones/Argonaut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Argonaut

License: MIT Regression Tests pages-build-deployment Dependencies Argonaut Wiki

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.

πŸ› οΈ Getting Started

Prerequisites

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)

Installation

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.

πŸš€ Usage

  • Compiler: Run :
    ./bin/argoc -a <source-file> -o <output-file>
    Use ././bin/argov --help for more options.
  • Virtual Machine: Run :
    ./bin/argov –a <intermediate-file>
    Use ./bin/argov –h for more options.

πŸ“œ Language Overview

Checkout the Argonaut Language Guide documentation to write your own programs in Argonaut.

Sample Program

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.

πŸ“š Language Features

I'll organize both the implemented and missing features by categories:

Data Types & Variables

  • 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

Operators

  • Arithmetic (+, -, *, /, %)
  • Comparison (==, !=, <, >, <=, >=)
  • Logical (&&, ||, !)
  • Assignment (:=)
  • Increment/decrement operators (++, --)
  • Compound assignment operators (+=, -=, etc.)
  • Ternary operator

Control Flow

  • If-else, else-if conditionals
  • While loops
  • For loops
  • Break and continue
  • Return statement
  • Switch/case statements
  • Do-while loops

Functions & Procedures

  • Functions with return values (only basic return types)
  • Procedures (void functions)
  • Parameters and arguments
  • Nested functions
  • Scope rules
  • Function overloading

I/O & System Integration

  • Basic console output (print)
  • Basic input reading
  • Format specifiers (%d, %f, %c, %s)
  • File I/O

Documentation & Comments

  • Single-line comments (//)
  • Multi-line comments

πŸ“‚ Project Structure

.
β”œβ”€β”€ 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

🀝 Contributing

We welcome contributions from the community! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with descriptive messages.
  4. Push your branch to your fork.
  5. Submit a pull request to the main repository.

πŸ“š Documentation

For detailed documentation, including language syntax, compiler architecture, and virtual machine specifications, please visit the Wiki.

πŸ“œ License

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

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published