Skip to content

minstrike520/compil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

awa1

A custom programming language interpreter written in Rust.

Description

This project is a simple interpreter for a custom programming language. It features a lexer, parser, and an interpreter that evaluates the abstract syntax tree (AST).

Structure

Frontend:

src: String --[lexing]--> token --[parsing]--> program<statement<expression>>

Runtime:

runtime.evaluate(program)

Getting Started

Prerequisites

  • Rust and Cargo must be installed on your system.

Building

To build the project, run the following command in the root directory:

cargo build

Running

The interpreter can be run in two modes:

  1. Shell Mode: To start the interactive shell, run:

    cargo run -- shell

    You can then enter expressions at the prompt. To exit the shell, type exit.

  2. File Mode: To execute a script file, run:

    cargo run -- <file_path>

    Replace <file_path> with the path to your script file.

Usage

The language supports basic expressions. Here is an example of what you can do in the shell:

> 1 + 2
NumberValue(3)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages