Skip to content

HackerDefuse/vendetta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vendetta Language

Vendetta - experimental programming language with the goal of achieving self-hosting capability.

Current Status

  • Stage: Bootstrap (Python interpreter)
  • Self-hosting: In development
  • Stability: Experimental

Features

  • Basic syntax
  • Variable declarations
  • Control flow (if/else, loops)
  • Functions
  • Arithmetic operations
  • String operations
  • Boolean logic
  • Comments
  • Compilation
  • Self-hosting
  • Standard library

Installation

git clone https://github.com/yourusername/vendetta.git
cd vendetta
python3 interpreter/interpreter.py examples/hello.vend

Quick Start

Create a file hello.vend:

# Hello World in Vendetta
echo "Hello, Vendetta!"

Run it:

python3 interpreter/interpreter.py hello.vend

Syntax Guide

Variables

Variables are declared using the mask keyword:

mask name = "Vendetta"
mask age = 25
mask pi = 3.14159
mask is_active = true

Basic Operations

mask x = 10
mask y = 20
mask sum = x + y
mask product = x * y
mask is_equal = x == y

Control Flow

If/Else Statements

mask score = 85

if score >= 90 {
    echo "Excellent!"
} else if score >= 70 {
    echo "Good job!"
} else {
    echo "Keep trying!"
}

Loops

mask counter = 0
loop counter < 5 {
    echo "Count: " + counter
    counter = counter + 1
}

Functions

function greet(name) {
    echo "Hello, " + name + "!"
}

function add(a, b) {
    return a + b
}

# Call functions
greet("Alice")
mask result = add(5, 3)
echo "5 + 3 = " + result

Comments

# This is a single line comment

# Multi-line
# comments
# are supported

Examples

1. Basic Arithmetic

# arithmetic.vend
mask a = 10
mask b = 5
mask sum = a + b
mask diff = a - b
mask prod = a * b
mask quot = a / b

echo "Sum: " + sum
echo "Difference: " + diff
echo "Product: " + prod
echo "Quotient: " + quot

2. Logic Operations

# logic.vend
mask x = 10
mask y = 20
mask is_greater = x > y
mask is_equal = x == y
mask is_not_equal = x != y

if is_greater {
    echo "x is greater than y"
} else {
    echo "x is not greater than y"
}

3. String Manipulation

# strings.vend
mask first_name = "John"
mask last_name = "Doe"
mask full_name = first_name + " " + last_name

echo "Full name: " + full_name

4. Functions and Recursion

# recursion.vend
function factorial(n) {
    if n <= 1 {
        return 1
    } else {
        return n * factorial(n - 1)
    }
}

mask result = factorial(5)
echo "5! = " + result

5. Simple Calculator

# calculator.vend
function calculate(a, op, b) {
    if op == "+" {
        return a + b
    } else if op == "-" {
        return a - b
    } else if op == "*" {
        return a * b
    } else if op == "/" {
        return a / b
    } else {
        echo "Unknown operator: " + op
        return 0
    }
}

mask x = 15
mask y = 3
echo "15 + 3 = " + calculate(x, "+", y)
echo "15 - 3 = " + calculate(x, "-", y)
echo "15 * 3 = " + calculate(x, "*", y)
echo "15 / 3 = " + calculate(x, "/", y)

Project Structure

vendetta/
|-- interpreter/
|   `-- interpreter.py    # Main interpreter entry point
|-- core/
|   |-- lexer.py         # Lexical analyzer
|   |-- parser.py        # Syntax parser
|   |-- ast.py           # Abstract Syntax Tree
|   `-- interpreter.py   # AST interpreter
|-- examples/
|   |-- hello.vend       # Hello World example
|   |-- arithmetic.vend  # Arithmetic operations
|   |-- logic.vend       # Logic operations
|   |-- strings.vend     # String operations
|   |-- recursion.vend   # Recursive functions
|   `-- calculator.vend  # Simple calculator
|-- docs/
|   `-- syntax.md        # Complete syntax reference
|-- README.md            # This file
|-- .gitignore           # Git ignore file
`-- LICENSE              # MIT License

Development

Running Tests

# Run all examples
python3 interpreter/interpreter.py examples/hello.vend
python3 interpreter/interpreter.py examples/arithmetic.vend
python3 interpreter/interpreter.py examples/logic.vend
python3 interpreter/interpreter.py examples/strings.vend
python3 interpreter/interpreter.py examples/recursion.vend
python3 interpreter/interpreter.py examples/calculator.vend

Debug Mode

python3 interpreter/interpreter.py --debug examples/hello.vend

Roadmap

Phase 1: Core Language (Current)

  • Basic syntax and semantics
  • Variable declarations
  • Control flow
  • Functions
  • Built-in operations

Phase 2: Advanced Features

  • Arrays and data structures
  • Error handling
  • Module system
  • Standard library

Phase 3: Compilation

  • Bytecode generation
  • Virtual machine
  • Optimization passes

Phase 4: Self-Hosting

  • Compiler written in Vendetta
  • Bootstrap process
  • Complete self-compilation

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Philosophy

Vendetta aims to demonstrate that a programming language can achieve self-hosting - the ability to compile itself using itself. This is a significant milestone in language design that few languages achieve.

The name "Vendetta" represents the language's relentless pursuit of independence and self-sufficiency, breaking free from dependence on external tools and compilers.

Acknowledgments

  • Inspired by classic self-hosting languages like C, Rust, and Go
  • Built with modern Python practices
  • Community-driven development

About

Experimental programming language aimed at self-hosting

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages