diff --git a/anicca.c b/anicca.c old mode 100755 new mode 100644 diff --git a/anicca.h b/anicca.h old mode 100755 new mode 100644 diff --git a/lexer.c b/lexer.c old mode 100755 new mode 100644 index f52d809..df29fb2 --- a/lexer.c +++ b/lexer.c @@ -15,13 +15,6 @@ #include "primitive.h" #include "lexer.h" -/* - parse_literal - input: Length of string, Pointer to string. - output: Array of type string with length (n-2). -*/ -static A parse_literal(I n, C *s) { A z = gstr(n-=2, ++s); R z; } - #define DCOL 9 #define DROW 10 @@ -39,6 +32,13 @@ static ST dfa[DROW][DCOL] = { /* CX CS CA CN CB C9 CD CC CQ */ }; +/* + parse_literal + input: Length of string, Pointer to string. + output: Array of type string with length (n-2). +*/ +static A parse_literal(I n, C *s) { A z = gstr(n-=2, ++s); R z; } + /* token_index input: Boxed string to be lexed. diff --git a/lexer.h b/lexer.h old mode 100755 new mode 100644 diff --git a/memory.c b/memory.c old mode 100755 new mode 100644 index d419716..6ceaa2e --- a/memory.c +++ b/memory.c @@ -8,7 +8,7 @@ #include "function.h" #include "memory.h" -VP a_malloc(I size) { V *m = malloc(size); ASSERT(m, ERALLOC); R m; } +VP a_malloc(I size) { VP m = malloc(size); ASSERT(m,ERALLOC); R m; } VO a_free(A y) { if (AN(y)>0) { free(AV(y)); if (AR(y)>0) { free(AS(y)); } } @@ -49,7 +49,7 @@ A ga(I t, I r, I n, I *s) { A z = (A)a_malloc(sizeof(struct _array)); AT(z) = t; AC(z) = 1; AR(z) = r; AN(z) = n; AS(z) = s; - if (n > 0) { AV(z) = a_malloc(ts(t)*n); } + if (n>0) { AV(z) = a_malloc(ts(t)*n); } R z; } diff --git a/memory.h b/memory.h old mode 100755 new mode 100644 diff --git a/noun.c b/noun.c index c364c84..ead96e8 100644 --- a/noun.c +++ b/noun.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/util.c b/util.c index fec1ee9..9ee006e 100644 --- a/util.c +++ b/util.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -43,7 +44,7 @@ VO print(A y) { }; break; } - case MARK: { printf("MARK"); break; } + case MARK: { break; } case LPAR: { printf("LPAR"); break; } case RPAR: { printf("RPAR"); break; } default: { printf("HUH?"); break; } @@ -51,8 +52,7 @@ VO print(A y) { } VO println(A y) { - print(y); - printf("\n"); + if (!(AT(y)&MARK)) { print(y); printf("\n"); } } VO a_init(VO) { diff --git a/verb.c b/verb.c old mode 100755 new mode 100644 index c9a2b82..c4cc527 --- a/verb.c +++ b/verb.c @@ -68,8 +68,8 @@ DYAD(plus) { A z = va2(CPLUS,x,y); R z; } MONAD(duble) { A z = plus(y, y); R z; } DYAD(append) { - I xt=AT(x), yt=AT(y), xr=AR(x), yr=AR(y); - I xn=AN(x), yn=AN(y), *xs=AS(x), *ys=AS(y); + I xt=AT(x), xn=AN(x), xr=AR(x), *xs=AS(x); + I yt=AT(y), yn=AN(y), yr=AR(y), *ys=AS(y); I t=MAX(xt,yt), r=MAX(xr,yr), zn=yn+xn, k; C *xv, *yv, *v; A p=x, q=y, z; if (xt&NUMERIC&&yt&NUMERIC && (xt!=yt)) { @@ -120,8 +120,8 @@ MONAD(indices) { MONAD_PROLOG; } MONAD(expntl) { - I yn = AN(y), *yv = IAV(y); - A z = ga(FLT, AR(y), yn, AS(y)); D *v = DAV(z); + I yn=AN(y), *yv=IAV(y); D *v; + A z=ga(FLT, AR(y), yn, AS(y)); v=DAV(z); DO(yn, v[i] = exp((D)yv[i])); R z; } diff --git a/verb.h b/verb.h old mode 100755 new mode 100644