Git Product home page Git Product logo

c-compiler's Introduction

C Compiler

By Eudis Duran

Compiling

Linux:

You can build the source with a single command. Make sure you are in the root src directory, and type: "make all" This will build both the compiler and virtual machine. The resulting executables will be placed in the root binary folder for the project. The programs are named "c" for the compiler, and "cvm" for the virtual machine.

Example Programs/Tests

Once you have built the compiler and virtual machine, both executables are also copied to the bin folder under 'examples.' The example programs can be built in a similar fasion. Change directory to examples/ and execute a "make" call. That will build all the examples for execution. In this case however, the Makefile will use my C compiler to build the examples, and will produce VM executables in the bin folder under the examples folders.

Windows:

Not tested.

Usage:

To compile a source file, first make sure that it adheres to the small C subset that is specified in the Documentation file, as not all of C is implemented yet.

Once you have checked that off, locate the compiler and VM executable in the bin directory and change to that directory through the command line. Assuming you have a test file, say test.c, you could type in the following to compile the file:

$ ./c test.c -o test.vm

That would compile the c source and produce a virtual machine bytecode executable. To run that exectuable, type in the following:

$ ./cvm test.vm

That would execute the program.

You can display a help screen by typing in --help in either of the program's command line arguments, like so:

$ ./c --help

or

$ ./cvm --help

c-compiler's People

Contributors

eudisd avatar

Watchers

Lu Hao avatar

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.