Skip to content

LDiazN/tac-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tac-runner

This is an interpreter for the low-level intermediate TAC code generated by the language bender compiler, see the TAC code specification here!

Requirements

You'll need the following tools to build this project:

Installing

This project it's available on linux only, and to install, just follow these steps:

  • git clone this project
  • cd into the root project folder
  • run make

And that's it! You know have the tac-runner ready to go.

Usage

After building, you'll have a new executable file tac-runner, you can use it as any other command line tool to run programs.

$ ./tac-runner --help
Tac Runner is a simple virtual machine capable of running tac code.
        Usage:
                tac-runner <name_of_file> [flags]
        Where:
                <name_of_file> : is the name of the file to be run, should be a valid tac code.
                 [flags] : Configuration flags, part of the following:
                        --help : Show this help
                        --memory : Show current memory state
                        --registers : Show registers
                        --labels : show current labels
                        --stack-mem-bytes n: show n bytes of stack memory

As the --help message suggests, the tac-runner tool is like a tiny little virtual machine tailored for the TAC intermediate code. You can check the memory, registers, currently running line, and more!

Samples

You can find a few code samples in the test_files folders. For example, you can run the recursive version of fibonacci using:

./tac-runner test_files/fib_rec.tac

Beware of big numbers, the word size is 4 (32 bits registers) so it might overflow quickly

This program will prompt you to input 1 if you want to test the fibonacci or 0 if you want to quit (Yes, it has input!). Then, if you choose 1, it will ask you for an input number and it will print its fibonacci number. For example:

DE 0 PARA TERMINAR O 1 PARA FIB REC
1
INTRODUZCA UN NUMERO MAYOR O IGUAL QUE 0
10
55

About

Interpretador de lenguaje intermedio TAC, ver https://github.com/LDiazN/TACTypes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages