Giter Site home page Giter Site logo

theps07 / c0vm Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 392 KB

A virtual machine for C0 that interprets bytecode using a stack implementation in C. Handles variables, errors, assertions, control flow, functions, memory allocation, generic pointers and function pointers.

Makefile 1.64% C 91.74% Shell 6.62%

c0vm's Introduction

15-122 Principles of Imperative Computation
The C0VM

==========================================================

Useful information:
   c0vm-ref.txt           - Bytecode implementation reference

Files
   lib/contracts.h     - Contracts for C
   lib/xalloc.h        - NULL-checking allocation
   lib/stack.h         - Stacks (with O(1) stack_size!)
   lib/c0v_stack.h     - C0 Value Stacks (with O(1) stack_size!)
   lib/c0vm_abort.h    - Functions for your C0VM to report runtime errors
   lib/c0vm_c0ffi.h    - Interface to the library functions
   lib/c0vm.h          - Header file, contains C0VM types and functions
   lib/read_program.h  - Reading in C0 bytecode from a file
   lib/*.o             - machine-specific object files
   c0vm_main.c         - Main function - loads bytecode, handles return
   c0vm.c              - Executes C0 bytecode

==========================================================

Compiling a C0 program to create a .bc0 file (produces tests/iadd.bc0):
   % cc0 -b tests/iadd.c0

Compiling and running your C0VM implementation (with -DDEBUG)
(Must compile iadd.c0 to iadd.bc0 first)
   % make
   % ./c0vmd tests/iadd.bc0

Compiling and running your C0VM implementation (without -DDEBUG)
(Must compile iadd.c0 to iadd.bc0 first)
   % make
   % ./c0vm tests/iadd.bc0

==========================================================

c0vm's People

Contributors

puru-samal avatar

Watchers

 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.