Skip to content

Simple compiler written in Rust for the Languages and Compilers class from Universidad Nacional de La Matanza

Notifications You must be signed in to change notification settings

LeanSerra/lm-compiler-rust

Repository files navigation

LM Compiler Rust

Simple compiler written in Rust using:

  • Rustemo as the parser generator
  • rflex as the lexer generator

Prerequisites

Features

v1.0.0

Feature Status File/s
Lexer rflex lexer file
Grammar rustemo grammar file
Symbol table Generate running the executable
Tests Run using cargo test

v2.0.0

Feature Status File/s
Intermediate code(Tree) ast
Tests Run using cargo test

v3.0.0

Feature Status File/s
Assembler output TASM generation
Linking script compile.bat

Running the compiler

  1. Run in debug mode
cargo run -- <INPUT-FILE>
  1. Run in release mode
cargo run --release -- <INPUT-FILE>

The executable requires an input file as a parmeter.

Running the tests

The integration test runs the compiler on all the files located at examples folder. Currently it only asserts that the compiler can run without errors on all the files, it does not check that the compilation output is correct.

cargo test

Generated files

When running the compiler it will output 4 files to the path of the source file

  • <source-file-name>.parser
  • <source-file-name>.lexer
  • <source-file-name>.symbol_table
  • <source-file-name>.dot

Cli reference

Usage: lm-compiler <INPUT_FILE>

Arguments:
  <INPUT_FILE>  Path to the source code file

Options:
  -h, --help     Print help
  -V, --version  Print version

About

Simple compiler written in Rust for the Languages and Compilers class from Universidad Nacional de La Matanza

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages