Now working in SWI Prolog master
authorNeil Smith <neil.git@njae.me.uk>
Sun, 5 Apr 2015 19:19:04 +0000 (20:19 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Sun, 5 Apr 2015 19:19:04 +0000 (20:19 +0100)
.gitignore [new file with mode: 0644]
SIGNED.md
lisp-interpreter.pl

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..5859a77
--- /dev/null
@@ -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
index 3e3947f228fdf0579244b7cb25963031eef5d2f9..9e57d628f3a614b698d24ecd31e404bd9cadab6f 100644 (file)
--- a/SIGNED.md
+++ b/SIGNED.md
@@ -3,19 +3,19 @@
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 -----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
-f4n2iZaNKVZhcyt6XQUffiQltLAmK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,8 @@ VLxyM8rtpo+2kwBA4noV
 ```
 size  exec  file                   contents                                                                                                                         
             ./                                                                                                                                                      
 ```
 size  exec  file                   contents                                                                                                                         
             ./                                                                                                                                                      
-7470          lisp-interpreter.pl  eafc6eb3c8a5ceeea3da0352031a3251fba59e9a7889b285c5328fa8abd5b899|b5046b37cb23c0ae81cbffc09037a0762bab6df6e92b1cb162725eb40b7dc318
+353           .gitignore           40827a01fd527e4c1eb5aac49bef7b0f4a370e79e965fc3cec0f5791a0e431f5                                                                 
+7657          lisp-interpreter.pl  5ecf8cdce9168ec3f7f60e2dbccc4a08fd3e873f5b55cc7b7052a20ddc2f9b4e|b1efd69cb929921991770f37578747e9cdd1c8e8d1e9716b4db35a5228de339a
 ```
 
 #### Ignore
 ```
 
 #### Ignore
index 2be75cd2bf0129771adf7cbae684d0d8f036d5c2..a036a73bede0836a9d830a1ec52fa059e63e21b5 100644 (file)
@@ -22,7 +22,8 @@
  *******************************************************************/\r
 \r
 \r
  *******************************************************************/\r
 \r
 \r
-:- style_check.\r
+:- style_check([+singleton, +no_effect, +var_branches, +atom, +discontiguous, \r
+       +charset]).\r
 \r
 :- dynamic \r
        bindings/1,\r
 \r
 :- dynamic \r
        bindings/1,\r
@@ -38,14 +39,15 @@ lisp:-
        write('Welcome to Pro-Lisp!'),nl,\r
        write('This is a miniscule Lisp interpreter, written in Prolog'),nl,\r
        prompt(Old, '> '),\r
        write('Welcome to Pro-Lisp!'),nl,\r
        write('This is a miniscule Lisp interpreter, written in Prolog'),nl,\r
        prompt(Old, '> '),\r
-       prompts(Old1, Old2),\r
-       prompts('> ', '> '),\r
+       prompts(Old1, Old2),\r
+       prompts('> ', '> '),\r
        tidy_database,\r
        repeat,\r
        read_eval_print(Result),\r
        Result = quit,\r
        prompt(_, Old),\r
        tidy_database,\r
        repeat,\r
        read_eval_print(Result),\r
        Result = quit,\r
        prompt(_, Old),\r
-       prompts(Old1, Old2).\r
+       % prompts(Old1, Old2).\r
+       true.\r
 \r
 \r
 tidy_database:-\r
 \r
 \r
 tidy_database:-\r
@@ -212,7 +214,8 @@ read_and_parse(Expression):-
 % read a line of supposed Lisp code\r
 \r
 read_words(Words):-\r
 % read a line of supposed Lisp code\r
 \r
 read_words(Words):-\r
-       get0(C),\r
+       % get0(C),\r
+       get_code(C),\r
        read_words(C, Words).\r
 \r
 read_words(C, []):-\r
        read_words(C, Words).\r
 \r
 read_words(C, []):-\r
@@ -232,14 +235,15 @@ read_words(C, [Word|Words]):-
        !,\r
        read_rest_of_word(Chars, LeftOver),\r
        name(UCWord, [C|Chars]),\r
        !,\r
        read_rest_of_word(Chars, LeftOver),\r
        name(UCWord, [C|Chars]),\r
-       ( atom(UCWord) -> lwrupr(Word, UCWord)\r
+       ( atom(UCWord) -> downcase_atom(UCWord, Word)\r
                ;       \r
                Word = UCWord),\r
        read_words(LeftOver, Words).\r
 \r
 \r
 read_rest_of_word(Chars, LeftOver):-\r
                ;       \r
                Word = UCWord),\r
        read_words(LeftOver, Words).\r
 \r
 \r
 read_rest_of_word(Chars, LeftOver):-\r
-       get0(C),\r
+       % get0(C),\r
+       get_code(C),\r
        read_rest_of_word(C, Chars, LeftOver).\r
 \r
 \r
        read_rest_of_word(C, Chars, LeftOver).\r
 \r
 \r
@@ -321,8 +325,10 @@ writeTokenL(['(', ')'|TokenL]):-
 writeTokenL([Token|TokenL]):-\r
        atom(Token),\r
        !,\r
 writeTokenL([Token|TokenL]):-\r
        atom(Token),\r
        !,\r
-       lwrupr(Token, UCToken),\r
-       write(UCToken),\r
+       % lwrupr(Token, UCToken),\r
+       % write(UCToken),\r
+       downcase_atom(Token, LCToken),\r
+       write(LCToken),\r
        write(' '),\r
        writeTokenL(TokenL).\r
 writeTokenL([Token|TokenL]):-\r
        write(' '),\r
        writeTokenL(TokenL).\r
 writeTokenL([Token|TokenL]):-\r