X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Flisp%2Fao_lisp_make_const.c;h=4fc43e583b6ca50f16d3f48cf264d2a23af9d650;hb=fb710f7f4f24f74ac3d45fcc423803384d986bb2;hp=6f852f9d9a1f15d6c1f148f53c10334c189595de;hpb=417161dbb36323b5a6572859dedad02ca92fc65c;p=fw%2Faltos diff --git a/src/lisp/ao_lisp_make_const.c b/src/lisp/ao_lisp_make_const.c index 6f852f9d..4fc43e58 100644 --- a/src/lisp/ao_lisp_make_const.c +++ b/src/lisp/ao_lisp_make_const.c @@ -33,6 +33,8 @@ struct builtin_func { }; struct builtin_func funcs[] = { + "eval", AO_LISP_FUNC_LAMBDA, builtin_eval, + "read", AO_LISP_FUNC_LAMBDA, builtin_read, "lambda", AO_LISP_FUNC_NLAMBDA, builtin_lambda, "lexpr", AO_LISP_FUNC_NLAMBDA, builtin_lexpr, "nlambda", AO_LISP_FUNC_NLAMBDA, builtin_nlambda, @@ -45,6 +47,8 @@ struct builtin_func funcs[] = { "set", AO_LISP_FUNC_LAMBDA, builtin_set, "setq", AO_LISP_FUNC_MACRO, builtin_setq, "cond", AO_LISP_FUNC_NLAMBDA, builtin_cond, + "progn", AO_LISP_FUNC_NLAMBDA, builtin_progn, + "while", AO_LISP_FUNC_NLAMBDA, builtin_while, "print", AO_LISP_FUNC_LEXPR, builtin_print, "patom", AO_LISP_FUNC_LEXPR, builtin_patom, "+", AO_LISP_FUNC_LEXPR, builtin_plus, @@ -101,20 +105,12 @@ main(int argc, char **argv) ao_lisp_atom_set(ao_lisp_atom_poly(a), ao_lisp_atom_poly(a)); - for (;;) { - sexpr = ao_lisp_read(); - if (!sexpr) - break; - printf ("sexpr: "); - ao_lisp_poly_print(sexpr); - printf("\n"); - val = ao_lisp_eval(sexpr); - if (ao_lisp_exception) - exit(1); - printf("\t"); - ao_lisp_poly_print(val); - printf("\n"); - } + /* end of file value */ + a = ao_lisp_atom_intern("eof"); + ao_lisp_atom_set(ao_lisp_atom_poly(a), + ao_lisp_atom_poly(a)); + + ao_lisp_read_eval_print(); /* Reduce to referenced values */ ao_lisp_collect();