Giter VIP home page Giter VIP logo

oxido-lang's Introduction

oxido-lang

Introduction

Oxido is an attempt to implement a small subset of Rust. The goal of the project is to explore the theory and implementation of pointer aliasing in Rust. The expected deliverable would comprise of a working parser, type and borrow checker, a compiler, and a virtual machine. Ideally, our final implementation should free/drop any variable who's lifetime is no longer valid. This should be accomplished without a need for any garbage collection. For more information on the project status, please refer to this section.

Project Status

  1. Parser is complete, refer to the grammar for more details about its syntax. Additional details are also available under the testing section as well.
  2. Type checker and borrow checker is currently both partially implemented and integrated. Refer to the v0 release section for more details.
  3. Compiler presently works for the following:
    • Literal Expressions (e.g. i64, bool, ())
    • Assignments
    • Primitive unary operations (e.g. !, -)
    • Primitive binary operations (e.g. +, -, *, /, ==, !=, >, >=, <, <=)
    • Block expressions
    • Function declarations
    • Function applications
    • String literals
    • Strings
    • String related operations
    • Reference related operations
  4. Virtual Machine is not complete.

Preliminaries

Please ensure that you have the latest stable release of Rust installed. Otherwise, do follow the installation instructions here.

Project Setup

Firstly, clone the repository to your local machine.

git clone https://github.com/cs4215-seville/oxido-lang.git

Once you've cloned the repository, proceed to build the project. This will produce a compiled binary in /target/debug/.

cargo build

To execute the compiled binary, run the command below and supply the path to your program. Your program would then be parsed, type-checked, compiled, and executed. As the virtual machine is currently not fully functional, execution would fail.

โš ๏ธ As the compiler doesn't yet compile for strings, references, and their operations, we recommend that you add the --skip-compile flag to avoid crashing the program if you're using any of those features.

./target/debug/oxido-lang --file-dir <DIR_TO_RUST_FILE> --heap-size=250

Testing

By convention, all tests can be found at the bottom of the file they're written for.

At present, tests are available for the parser and the test files can be found in parse examples. Of the 60 test files, the parser is able to correctly parse 59 syntatically valid programs, and correctly reject one. Basic tests are present for the compiler as well. To run the tests, execute the following in the project root.

cargo test

What release v0 contains

Parser: parse the Rust-subset langauge input to an AST
(completed, but one word fix required in ast.rs to change push_str from unary operation to binary operation).

Static Checker: process the AST to output an error message, or a Mapping of line_no : variable_names, that specifies after which line, which variables should be dropped.
(incomplete. Updating of the borrow stack at the instatiation of every variable occurs, but deletion is partial.)

Compiler/VM : runs the code using the AST and mappings of variable drops fed by the static checker. Shows that all allocated memory is cleared at the end of program.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.