Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The Next Symta

Name: Anonymous 2014-03-12 19:27

An experimental Lisp-like language:
https://github.com/saniv/symta

Of course that is a prototype, but it shows how initial parentheses-ridden mess (root/boot/*.hit files) bootstraps into a readable language (root/lib/*.hit files).

Name: Anonymous 2014-04-06 19:04

Providing essential arithmetic functions requires more lines of C/C++ code than the whole compiler itself! And these are very basic - no bignums!
[m]
static void b_add() {
void *k, *a, *b;
CHECK_NARGS(3);
k = getArg(0);
a = getArg(1);
b = getArg(2);
CHECK_TAG(a, T_INTEGER);
CHECK_TAG(b, T_INTEGER);
ALLOC(E, 1);
STORE(E, 0, getVal(a) + getVal(b));
MOVE(N, 1);
CALL(k);
}

static void b_mul() {
void *k, *a, *b;
CHECK_NARGS(3);
k = getArg(0);
a = getArg(1);
b = getArg(2);
CHECK_TAG(a, T_INTEGER);
CHECK_TAG(b, T_INTEGER);
ALLOC(E, 1);
STORE(E, 0, (getVal(a)>>TAG_BITS) * getVal(b));
MOVE(N, 1);
CALL(k);
}

static struct {
char *name;
void (*fun)();
} builtins[] = {
{"+", b_add},
{"*", b_mul},
{0, 0}
};

static void host_f() {
int i;
uintptr_t *k, *t_name;
CHECK_NARGS(2);
k = getArg(0);
t_name = getArg(1);
CHECK_TAG(t_name, T_STRING);

char *name = (char*)getVal(t_name);
for (i = 0; builtins[i].name; i++) {
if (!strcmp(builtins[i].name, name)) {
ALLOC(E, 1);
CLOSURE(R, builtins[i].fun);
STORE(E, 0, R);
MOVE(N, 1);
CALL(k);
}
}

printf("host doesn't provide \"%s\"\n", name);
abort();
}
[/m]

Name: Anonymous 2014-04-06 19:05

This retarded engine doesn't support the [m] tag

static void b_add() {
void *k, *a, *b;
CHECK_NARGS(3);
k = getArg(0);
a = getArg(1);
b = getArg(2);
CHECK_TAG(a, T_INTEGER);
CHECK_TAG(b, T_INTEGER);
ALLOC(E, 1);
STORE(E, 0, getVal(a) + getVal(b));
MOVE(N, 1);
CALL(k);
}

static void b_mul() {
void *k, *a, *b;
CHECK_NARGS(3);
k = getArg(0);
a = getArg(1);
b = getArg(2);
CHECK_TAG(a, T_INTEGER);
CHECK_TAG(b, T_INTEGER);
ALLOC(E, 1);
STORE(E, 0, (getVal(a)>>TAG_BITS) * getVal(b));
MOVE(N, 1);
CALL(k);
}

static struct {
char *name;
void (*fun)();
} builtins[] = {
{"+", b_add},
{"*", b_mul},
{0, 0}
};

static void host_f() {
int i;
uintptr_t *k, *t_name;
CHECK_NARGS(2);
k = getArg(0);
t_name = getArg(1);
CHECK_TAG(t_name, T_STRING);

char *name = (char*)getVal(t_name);
for (i = 0; builtins[i].name; i++) {
if (!strcmp(builtins[i].name, name)) {
ALLOC(E, 1);
CLOSURE(R, builtins[i].fun);
STORE(E, 0, R);
MOVE(N, 1);
CALL(k);
}
}

printf("host doesn't provide \"%s\"\n", name);
abort();
}

Name: Anonymous 2014-04-06 19:09

>>42
It supports monospaced tags just fine. You were just doing it wrong.

Name: Anonymous 2014-04-07 16:33

>>43

[pre]does that work?[/pre]

Name: Anonymous 2014-04-07 17:33

>>44
There is a preview button.

Name: Anonymous 2015-05-09 17:47

>>40
Who are you quoting?

Name: Anonymous 2015-05-10 11:37

>>46
Whom are you quoting?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List