Code Monkey home page Code Monkey logo

pl0's Introduction

For this project, there is a Makefile which will handle all of the compilation. Browse to the folder that contains the Makefile and run one of these commands:

  • make: Build a single executable pl0 (optimizations on, debug and asserts off)
  • make debug: Build the executable in debug configuration (optimizations off, debug and asserts on)
  • make debug+: Build the executable in debug configuration and using clang's Address Sanitizer (eustis doesn't have clang so this won't work there) (run make clean before changing between a normal build and a debug+ build)
  • make graph: Build the executable and run it on input.txt to produce the Graphviz input files, then run those through Graphviz to produce the rendered pdfs (eustis doesn't have Graphviz so this won't work there)
  • make run: Build the executable in debug configuration and run it to produce all output files
  • make archive: Build the executable in debug configuration and run it on the input file to produce all of their output files, then create the zip containing all of the source code, test cases, input and output files, Makefile, .gitignore, README.md, and other documentation
  • make clean: Remove all built products (including the executable in the top-level directory and the zip)

Additionally, the Makefile understands the following variables:

  • make ... VERBOSE=1: Echo all commands before running them
  • make ... WITH_BISON=1: Build with support for the Bison generated parser.
  • make ... WITH_LLVM=1: Build with support for the LLVM code generator.

If you simply run command make an executable pl0 will be produced.

After the PL/0 toolchain is built, simply run command ./pl0 to process input.txt and produce all the output files.

pl0 also allows for command line switches. Run ./pl0 --help to see a list of the available options. Example output:

Usage: ./pl0 [-acdhlmnprsv]
Options:
    -h, --help               Display this help message
    -l, --tee-token-list     Duplicate token list to stdout
    -s, --tee-symbol-table   Duplicate symbol table to stdout
    -a, --tee-disassembly    Duplicate disassembly to stdout
    -v, --tee-program-trace  Duplicate program trace to stdout
    -m, --tee-machine-code   Duplicate machine code to stdout
    -p, --markdown           Pretty print output as Markdown
    -c, --compile-only       Compile only, do not run
    -r, --run-only           Run only, do not compile
    -d, --debug              Run program in the PM/0 debugger
    -n, --no-stacktrace      Don't write stacktrace while running (MUCH FASTER!)
        --parser=rdp         Use the recursive descent parser (default)
        --parser=bison       Use the Bison-generated parser
        --codegen=pm0        Use the PM/0 code generator (default)
        --codegen=llvm       Use the LLVM code generator

This compiler supports calling procedures with parameters and returning a functional value. Arrays are currently not supported.

pl0's People

Contributors

kjcolley7 avatar

Stargazers

Miha  avatar René Pereira avatar Eason Wang avatar MeowFET avatar Charlton Trezevant avatar 泛红橘子 avatar HuangHaiFeng avatar Sydney avatar Autumn avatar Julio Gutierrez avatar

Watchers

James Cloos avatar  avatar

pl0's Issues

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.