Giter VIP home page Giter VIP logo

tinyvm's Introduction

TinyVM is a virtual machine with the goal of having a small footprint.
Low memory usage, a small amount of code, and a small binary.

Building can be accomplished on UNIX-like systems with make and GCC.

There are no external dependencies, save the C standard library.

Building can be accomplished using "make," or "make rebuild".

To build a debug version, add "DEBUG=yes" after "make". To build a binary with
profiling enabled, add "PROFILE=yes" after "make".

I can be reached at "joseph.kogut(at)gmail.com"

tinyvm's People

Contributors

arcuru avatar bl0ckeduser avatar cchuahuico avatar eldev avatar jakogut avatar jepler avatar kksym avatar peterreid avatar tekknolagi avatar turnage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tinyvm's Issues

Minor typo

Hi,

this is to report that on line 94 of the syntax guide,
"modulus" is spelled incorrectly as "modulous".

license info?

Sorry, I can't find licensing information, neither in README, nor in LICENSE (can't see such file), nor in a few source/header files I checked. Is it there somewhere? What it is? Could you please make it more prominent? Thanks.

How to run the program?

I have successfully build the program , but how can I run it.
I am on linux mint. Every time I try ./tvmi it gives the following error
File was not found, or does not exist. Unable to interpret.

i have a complier error,please help

my environment is macos , when i make.

clang src/tvmi.c -ltvm -Wall -pipe -Iinclude/ -std=gnu11 -Werror -pedantic -pedantic-errors -O3 -Llib/ -o bin/tvmi

ld: library not found for -ltvm

clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [tvmi] Error 1

Comments.

Please comment this code. It looks like a really excellent project for learning about virtual machines but people wont use it that way if its a pain to figure out whats going on.

If not comments then please provide documentation.

Misprint in tvm_stack.c

Maybe I something don't understand, why do you write in method stack_pop

s->items = (int*)realloc(s->items, s->num_items);

and not

s->items = (int*)realloc(s->items, s->num_items * sizeof(int));

build error~

# make rebuild DEBUG=yes  PROFILE=yes
gcc -Wall -pipe -Iinclude/ -std=c99 -g -Werror -pedantic -pedantic-errors -O3 -c
 libtvm/tvm.c -o libtvm/tvm.o
In file included from libtvm/tvm.c:1:0:
include/tvm/tvm.h:63:24: error: 'printf' is static but used in inline function '
tvm_step' which is not static
make: *** [libtvm/tvm.o] Error 1

i delete the inline attribute,but it still not work,said

lib//libtvm.a(tvm.o): In function `tvm_step':
G:\minienv2\env\mingw\msys\1.0\home\Wener\gits\tinyvm/include/tvm/tvm.h:26: mult
iple definition of `tvm_step'
C:\Users\Wener\AppData\Local\Temp\ccbvfXLm.o:G:\minienv2\env\mingw\msys\1.0\home
\Wener\gits\tinyvm/include/tvm/tvm.h:26: first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [tvmi] Error 1

Improve error handling while parsing

Thanks for your work! There are a couple of things I see that can be improved, especially error handling. Tinyvm doesn't seem to check whether given instructions are correct or not, and it simply parses any kind of file (even an empty one) which results in a segfault. Maybe check if there's any matching token that exists or not and then parse? Besides, tinyvm also doesn't handle errors if an instruction register is missing or incomplete, e.g. instead of add eax, 1 if we just give add vm will get a segfault. Also, instructions like ret result in segfault (not sure what causes it).

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.