This commit is contained in:
parent
6ad9490f45
commit
d0acff37be
|
@ -1,3 +1,4 @@
|
|||
<> (duppre ?x) (?x ?x)
|
||||
<> (?x dup) (?x ?x)
|
||||
<> (?x ?y swap) (?y ?x)
|
||||
|
||||
what (duppre twice)
|
||||
(1234 dup)
|
|
@ -11,15 +11,17 @@ static char prog[0x1000], *prog_ = prog;
|
|||
static char outp[0x1000], *outp_ = outp;
|
||||
static char *regs[0x100];
|
||||
|
||||
#define spacer(c) (c == ' ' || c == '(' || c == ')')
|
||||
|
||||
static char *
|
||||
walk(char *s)
|
||||
{
|
||||
int depth = 0;
|
||||
char c;
|
||||
while((c = *s++)) {
|
||||
if(spacer(c) && !depth) break;
|
||||
if(c == '(') depth++;
|
||||
if(c == ')') --depth;
|
||||
if(c == ' ' && !depth) break;
|
||||
}
|
||||
return s - 1;
|
||||
}
|
||||
|
@ -42,9 +44,9 @@ writereg(char r)
|
|||
int depth = 0;
|
||||
char c, *s = regs[(int)r];
|
||||
while((c = *s++)) {
|
||||
if(spacer(c) && !depth) break;
|
||||
if(c == '(') depth++;
|
||||
if(c == ')') --depth;
|
||||
if(c == ' ' && !depth) break;
|
||||
*outp_++ = c;
|
||||
}
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue