Git Product home page Git Product logo

.kek-on-rails's Introduction

.KEK-on-Rails

A C-like language interpreter

          _  __    ___    _  __  
         | |/ /   | __|  | |/ /  
    _    | ' <    | _|   | ' <   
  _(_)_  |_|\_\   |___|  |_|\_\  
_|"""""|_|"""""|_|"""""|_|"""""| 
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-' 

FAQ

Features

  • Object oriented language with inheritance and dynamic dispatch
  • Dynamic type system
  • Exception handling
  • Growing arrays (like C++ vectors)
  • Tail call optimization (automatically detects RET after CALL and reuses stack frame)
  • Tagged integers and chars
  • Inline cache
  • Cheney's copying GC

Garbage collector flags

If you're testing something and it doesn't work, it's a good idea to turn off gc completely. Because there may be a bug in gc. There is a list of available options:

  • -gN or -g none no gc at all. The virtual machine will use just malloc underneath. All memory is stored in a global LL and free'd at the end of the vm. state: working without any known bugs
  • -gn or -g new only new space. All objects are created in to-space. When there is no space for an obj we want to allocate, the Cheney's copying GC swaps to- and from- space, and copy live object back to the to- space. state: working without any known bugs
  • -gg or -g gen generational gc. It's almost the same as the previous mehthod, but if an obj survives in new space for two Cheney's copying, the object is moved into the old space. state: there are some rare bugs
  • -gG or -g genmas generational gc with mark-and-sweep algorithm in old space. state: not yet implemented
  • -gM or -g genmasmac generational gc with mark-and-sweep and mark-and-compact algorithm in old space. state: not yet implemented

TODO

  • generational gc with mark-and-sweep and mark-and-copy
  • one classfile per class
  • native class wrapping SDL
  • lambda functions
  • closures
  • continuations
  • JIT

Debugging

Life is hard, but it's even harder when you program in C. Programming in reality is really different than what we can see in movies. We used Valgrind and GDB.

Valgrind

Example of running scheme from the root directory of the repository:

      make -C ../compiler && ../compiler/kekc scheme.kek ../tests/kexes/scheme.kexe && make -C ../vm && valgrind --show-leak-kinds=all --leak-check=full --track-origins=yes ../vm/kek ../tests/kexes/scheme.kexe

GDB

If you're lazy to write GDB command over and over, here are some one-liners;

      make -C ../vm && gdb -ex "set confirm off" -ex "file ../vm/kek" [INSERT BREAKPOINT HERE] -ex "set args ../tests/kexes/scheme.kexe sat.scm sat_in.txt" -ex "r"

some breakpoints we've used:

  • -ex "break vm.c:616 if tick == 10450"
  • -ex "watch *0x7ffff6da51d0"

.kek-on-rails's People

Contributors

nesro avatar nohajc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

nesro wxuefei

.kek-on-rails's Issues

KEK train appears to be stuck in the station

Instruction KEK is missing from the instruction set. It should summon a train with KEK, but there's no sight of the instruction or the train.

Is it because the station is under reconstruction or are they out of KEK? Would you consider fixing the KEK train in the next update?

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.