Added first syscall example
This commit is contained in:
parent
a0bb670722
commit
1713409a40
|
@ -1,8 +1,3 @@
|
||||||
<> (eq ?x ?x) (#t)
|
<> ((send ?:)) ()
|
||||||
<> (eq ?x ?y) (#f)
|
|
||||||
<> (q ?x) (q ?x)
|
|
||||||
<> (if ?c ?t ?f) (if/q ?c q ?t q ?f)
|
|
||||||
<> (if/q (#t) q ?t q ?f) (?t)
|
|
||||||
<> (if/q (#f) q ?t q ?f) (?f)
|
|
||||||
|
|
||||||
if (eq foo bar) (if (eq foo baz) a b) (if (eq foo foo) b c)
|
(send (hello world))
|
13
src/modal.c
13
src/modal.c
|
@ -42,6 +42,15 @@ compare(char *a, char *b)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
call(char *s)
|
||||||
|
{
|
||||||
|
char *ss = walk(s);
|
||||||
|
if(*s == '(') s++, --ss;
|
||||||
|
while(s < ss)
|
||||||
|
putc(*(s++), stdout);
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
match(char *p, Rule *r)
|
match(char *p, Rule *r)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +64,9 @@ match(char *p, Rule *r)
|
||||||
if(regs[id]) {
|
if(regs[id]) {
|
||||||
if(!compare(regs[id], b))
|
if(!compare(regs[id], b))
|
||||||
return NULL;
|
return NULL;
|
||||||
} else
|
} else if(id == ':')
|
||||||
|
call(b);
|
||||||
|
else
|
||||||
regs[id] = b;
|
regs[id] = b;
|
||||||
a++, b = walk(b), c = *b;
|
a++, b = walk(b), c = *b;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue