HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
tekknolagi
carp
C2014–2016
tekknolagi / carp · Archived

carp

"interesting" VM in C. Let's see how this goes.

4Distinct people
8Mentions
0Explicit recommenders
985GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

"interesting" VM in C. Let's see how this goes.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year8 dated mentions

Observed mentions: 2014-03-06 02:55:37 UTC to 2016-11-28 02:17:57 UTC.

02462014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC716
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC000
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC101

What Hacker News says

8 sources
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 sync. There's probably quite a few places where the code could be made clearer by using it. Also in the implementation of your functions, there's a hell of a lot of repetition in all the binary operations, another macro which you pass in the operation and the function name would make life earier: #define binop(NAME, OP) definstr (NAME) { \ long long b, a; \ if (carp_stack_pop(&m->stack, &b) == -1)\ carp_vm_err(m, CARP_STACK_EMPTY);\ if (carp_stack_pop(&m->stack, &a) == -1)\ carp_vm_err(m, CARP_STACK_EMPTY);\ carp_stack_push(&m->stack, a OP b);} binop(ADD,+) binop(MUL,*) ... The repetition
Read the rest
of if (carp_stack_pop(&m->stack, &a) == -1) carp_vm_err(m, CARP_STACK_EMPTY); seems like a good place to just use a function to encapsulate all the error checking and handling. [1] https://github.com/tekknolagi/carp/blob/master/src/carp_inst... [2] http://www.embedded.com/design/programming-languages-and-too... and the following parts
In Show HN: A small virtual machine written in C
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 a tantalizing target called 'tests' in the Makefile, but it doesn't work. There's some examples, but no makefile to build them. How do you run them? I see you used to have some .carp files but you just deleted them: https://github.com/tekknolagi/carp/commit/fa16eeb443 I tried restoring one, but it doesn't work: $ git checkout fa16eeb443~1 examples/reg.carp $ ./carp -f examples/reg.carp Unknown label <add> So at this point I'm ready to give up..
In Show HN: A small virtual machine written in C

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.