10000 GitHub - mughees-raza/rust-lox: Lox implementation with extra features in rust
[go: up one dir, main page]

Skip to content

mughees-raza/rust-lox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Lox

A walking tree interpreter for the Typhoon programming language.

Syntax

Typhoon is a dynamically-typed, interpreted language with a syntax similar to C and JavaScript. Here are some basic examples:

Variables

var name = "Alice";
var age = 25;

Control Flow

If-Else

if (age > 18) {
    print "You are an adult.";
} else {
    print "You are a minor.";
}

While Loop

var count = 0;
while (count < 5) {
    print count;
    count = count + 1;
}

Functions

fun greet(name) {
    print "Hello, " + name + "!";
}

greet("Alice");

Classes

class Person {
    init(name, age) {
        this.name = name;
        this.age = age;
    }

    sayHello() {
        print "Hello, my name is " + this.name;
    }
}

var alice = Person("Alice", 25);
alice.sayHello();

Features

  • Dynamically typed
  • Object-oriented (single inheritance)
  • Functions as first-class citizens
  • Lexical scoping

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/typhoon.git
    cd typhoon
  2. Build and run:

    cargo run 

Usage

Run a Typhoon script with:

typhoon script.typhoon

Or enter the REPL mode:

typhoon
>

Contributing

Feel free to open issues and pull requests!

License

This project is licensed under the MIT License.

About

Lox implementation with extra features in rust

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0