carp

Dev tools

virtual machine

SHOW HN2014

212points
91comments
#91of 2,272 in 2014
Top 5%of 2014 by points

How HN took it

MixedNo clear lean

12 positive, 8 neutral or asking, 1 mixed, 4 critical, out of 25 comments about the project. Thread score +0.38.

Execution: 4 for, 3 againstDesign: 4 for, 0 againstDocs: 1 for, 1 againstIdea: 1 for, 0 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Clean, concise implementation

    From 3 comments
    • The code looks really clean to me. If you feel the urge to convert the VM to a JIT, rather than calling function pointers for each instruction, you might find this blog post…
      papaf on HN
    • Very concise implementation. I keep thinking there's missing files or at least I'm missing something in my understanding. :) I wrote a 0-operand VM in C a few years ago that used…
      dsturnbull2049 on HN
    • Can you give some directions for how to run it? ``` $ git clone https://github.com/tekknolagi/carp $ make $ ./carp $ ./carp --help # after peeking in carp.c help msg ``` There's…
      akkartik on HN
  • Binop macro and X macro ideas

    From 2 comments
    • Seems like [1] could benefit from use of the X macro [2], should make adding new instructions much easier and you can avoid the hassle of having to keep two separate tables in…
      axman6 on HN
    • Ah, I feel you — no problem! I do really love the binop macro.
      tekknolagi on HN

Objections

  • Build instructions and examples do not work out of the box

    From 3 comments
    • Can you give some directions for how to run it? ``` $ git clone https://github.com/tekknolagi/carp $ make $ ./carp $ ./carp --help # after peeking in carp.c help msg ``` There's…
      akkartik on HN
    • You're welcome. I pulled the new commits, but I'm still having trouble running the examples: ``` $ ./carp -f examples/carp/call.carp Unknown label <add> ``` (I am very interested…
      akkartik on HN
    • Nope, rebuilding didn't help.. never mind, I'll look into it later tonight. Edit: I just noticed you changed the target (why?) and are also immediately deleting carp.out. So I…
      akkartik on HN
  • No tests

    From 2 comments
    • Out of curiosity - How are you testing your VM? meaning, how do you know it actually works correctly? I didn't see any tests in the github repository
      ravyoli on HN
    • I am not testing — and I know this is horrifying. I need to write some tests. D:
      tekknolagi on HN
  • Mixed register and stack instruction design is inconsistent

    From 2 comments
    • Is there a reason for the combination of register-based (logical ops) and stack-based (arithmetic ops) operations? Otherwise fun project.
      ghkbrew on HN
    • The implementation is really clean! The mixing of general-purpose registers, special-purpose registers and the stack makes the instruction set a bit weird, though. For example,…
      panic on HN

Requests

  • Add tests

    From 2 comments
    • I am not testing — and I know this is horrifying. I need to write some tests. D:
      tekknolagi on HN
    • I am now starting to write some tests with libtap. If you are game, come help out! :D
      tekknolagi on HN
  • Add documentation and help message

    From 2 comments
    • Hi there! Sorry for this. I actually have a help message but for some reason I forgot to commit it. It's coming soon! You run the examples like so: carp -f…
      tekknolagi on HN
    • Alright, try now. Also — thanks for the pull request!
      tekknolagi on HN
  • Consider JIT compilation

    From 2 comments
    • The code looks really clean to me. If you feel the urge to convert the VM to a JIT, rather than calling function pointers for each instruction, you might find this blog post…
      papaf on HN
    • You'd essentially be generating machine code on the fly and letting the cpu execute it, instead of interpreting anything yourself.
      TheHydroImpulse on HN

Questions

  • How to run the examples

    From 2 comments
    • Can you give some directions for how to run it? ``` $ git clone https://github.com/tekknolagi/carp $ make $ ./carp $ ./carp --help # after peeking in carp.c help msg ``` There's…
      akkartik on HN
    • You're welcome. I pulled the new commits, but I'm still having trouble running the examples: ``` $ ./carp -f examples/carp/call.carp Unknown label <add> ``` (I am very interested…
      akkartik on HN
  • Literature on VM design

    From 1 comment
    • Can anyone link me to some literature on VMs? Sure, I can analyse the code, but from a design perspective, I would love to learn more about how VMs work, where they can be used,…
      manish_gill on HN

Alternatives named

  • MSP430 instruction set

    From 2 comments
    • So I started off following this (http://en.wikibooks.org/wiki/Creating_a_Virtual_Machine/Register_VM_in_C) which was interesting but clearly never super influential in my design…
      tekknolagi on HN
    • I started off following MSP430 but just kind of wanted to make my own thing.
      tekknolagi on HN
  • Lua VM

    From 1 comment
    • As inspiration, I would suggest to look at the virtual machine (byte code interpreter) of the Lua language. You can find several papers describing the design at…
      lindig on HN
  • Synacor VM challenge

    From 1 comment
    • This is neat. For others interested in this sort of thing, https://challenge.synacor.com/ specifies a virtual machine, and comes with a binary that performs a self-test -- it is…
      abhorrence on HN
  • LC3b VM course at Georgia Tech

    From 1 comment
    • Very cool! Georgia Tech offers a class where you code a VM for the LC3b instruction set (http://users.ece.gatech.edu/~moin/s13a/hw.html). It was a great learning experience, and…
      cobookman on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/8130413)