From: Neil Smith Date: Sun, 5 Apr 2015 19:19:04 +0000 (+0100) Subject: Now working in SWI Prolog X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=lisp-interpreter-in-prolog.git Now working in SWI Prolog --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5859a77 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# cache files for sublime text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# workspace files are user-specific +*.sublime-workspace + +# project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using SublimeText +# *.sublime-project + +# sftp configuration file +sftp-config.json \ No newline at end of file diff --git a/SIGNED.md b/SIGNED.md index 3e3947f..9e57d62 100644 --- a/SIGNED.md +++ b/SIGNED.md @@ -3,19 +3,19 @@ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 -iQIcBAABAgAGBQJVIWrYAAoJEJPB2e07PgbqkTcP+wfQUCdTBpwpbll0DKBIxH69 -79/ddLpdKLLPCMVzphun3p7XqfxK0haCx2wwhWsquv3dywPO0wpCT32vm2QHb0FM -Di+aUbklJa54LOGg0ljeJ5MCB6OmL1E5tTIH+m/q0bfkdSpWKLglX3SfZskBgsxl -/3D4OE0bmDoLPQIM+EtOW6kogD8i+0pWpUWoamR08iSpBb6PdlbdbAah2ocAeoS9 -pa8DB7g2412RS2nsxWfhD64hhNN/HaHWo/O/gO+FJOphqD/g++eUGxK3mB8W3NAM -KOtenoLa89VhDxZWhgG+/RwW3iw2EIl4pn1QbIIjFy19r79JNuV4KDqqgUj4Ewgd -qp5AZ6WWsUt7EWvDLxvXA9pVYci7ebNtkvNZvhwUQFABigCy2jjDVNzhPQBk9/Hw -f4n2iZaNKVZhcyt6XQUffiQltLAmKEBpBKlInP5mH1gRoWhYCG2tzovGNK9HyoNh -h1H27u6c4JBft6XokBjjWALZ4TfdpBefzhy7Mf+sidvVcOS1vpGiZ0V1CPuN659O -Bx9Gn2FZasegjBkB+/qVpl7vF0yf5Sf2R8TvIpd1Ko5ox2XNntvE85tsTtAk1KQW -hIzSvrFvs0en8u0dUr9NiuDzRr7w0vm68jrPIydzwuwAgreItIMF4rh/IrLDcpek -VLxyM8rtpo+2kwBA4noV -=sQZ7 +iQIcBAABAgAGBQJVIYqsAAoJEJPB2e07PgbqrMQP/3yMMqOhe505uOe+DyRx24if +rYlkjCxUu70uDIYnpcWkB7ftxNQdDndCBUjaPcTnY/Bp6uRaR2ddl2WugTj5I0us +D7AwkGpUKDKs/5wxypqZXUYWVe6WpvHhQao/E9XsIReA5WvCXbQGpx4++VB9IgOH +5TD4q85EONdnpP0KY4FYF/UYhV/uSJjie0iYp0sNuse+VuMG/TE8/dM0q7aXCAkn +wTqdjxQfOfjSNIsU9OYTkZ2vmtU6L0Bq8c1GHljalfEtOw1e/+9TlwbRCWqVQAsP +BCTrtOu4zcSl0K6FbbwOY7jUFx0f9f9Mb0P63yEXbJ4znzG430KbHJLXG3TA4QmT +eH6WtpX4C2uKkFbbKoqBx+ERPGcTZXbCdUYUleAhVHl5gDp836yPpv8AF+xj/Vxn +1sJwW1FACmYRjluL+AInROUPv+GiCwvTQGlbqG1+vzEoqmuFpj6FtygMeYWGzapC +RLmXxwTW4rIke58U9aBmXmUd9PEtgCLqEvk8jgS/6yRi0Y6Hy9wDHBFRt5NdWTSn +DsxmDhh4pC8G64UNQ4SgvD88rpoL9assGLHyrJVhc1h+Rb6y3+3hF+k9CB1WMK+J +PS8c7bD9ZvfVTzx9m386Ub5DgQqa8morniKD78pGnlXAomUBjzKBbYj+C1Red32b +ipXmsgeapbRUk3YhDW9X +=QRD0 -----END PGP SIGNATURE----- ``` @@ -29,7 +29,8 @@ VLxyM8rtpo+2kwBA4noV ``` size exec file contents ./ -7470 lisp-interpreter.pl eafc6eb3c8a5ceeea3da0352031a3251fba59e9a7889b285c5328fa8abd5b899|b5046b37cb23c0ae81cbffc09037a0762bab6df6e92b1cb162725eb40b7dc318 +353 .gitignore 40827a01fd527e4c1eb5aac49bef7b0f4a370e79e965fc3cec0f5791a0e431f5 +7657 lisp-interpreter.pl 5ecf8cdce9168ec3f7f60e2dbccc4a08fd3e873f5b55cc7b7052a20ddc2f9b4e|b1efd69cb929921991770f37578747e9cdd1c8e8d1e9716b4db35a5228de339a ``` #### Ignore diff --git a/lisp-interpreter.pl b/lisp-interpreter.pl index 2be75cd..a036a73 100644 --- a/lisp-interpreter.pl +++ b/lisp-interpreter.pl @@ -22,7 +22,8 @@ *******************************************************************/ -:- style_check. +:- style_check([+singleton, +no_effect, +var_branches, +atom, +discontiguous, + +charset]). :- dynamic bindings/1, @@ -38,14 +39,15 @@ lisp:- write('Welcome to Pro-Lisp!'),nl, write('This is a miniscule Lisp interpreter, written in Prolog'),nl, prompt(Old, '> '), - prompts(Old1, Old2), - prompts('> ', '> '), + % prompts(Old1, Old2), + % prompts('> ', '> '), tidy_database, repeat, read_eval_print(Result), Result = quit, prompt(_, Old), - prompts(Old1, Old2). + % prompts(Old1, Old2). + true. tidy_database:- @@ -212,7 +214,8 @@ read_and_parse(Expression):- % read a line of supposed Lisp code read_words(Words):- - get0(C), + % get0(C), + get_code(C), read_words(C, Words). read_words(C, []):- @@ -232,14 +235,15 @@ read_words(C, [Word|Words]):- !, read_rest_of_word(Chars, LeftOver), name(UCWord, [C|Chars]), - ( atom(UCWord) -> lwrupr(Word, UCWord) + ( atom(UCWord) -> downcase_atom(UCWord, Word) ; Word = UCWord), read_words(LeftOver, Words). read_rest_of_word(Chars, LeftOver):- - get0(C), + % get0(C), + get_code(C), read_rest_of_word(C, Chars, LeftOver). @@ -321,8 +325,10 @@ writeTokenL(['(', ')'|TokenL]):- writeTokenL([Token|TokenL]):- atom(Token), !, - lwrupr(Token, UCToken), - write(UCToken), + % lwrupr(Token, UCToken), + % write(UCToken), + downcase_atom(Token, LCToken), + write(LCToken), write(' '), writeTokenL(TokenL). writeTokenL([Token|TokenL]):-