Giter Site home page Giter Site logo

lisp9's Introduction

	This is a fork of LISP9 based on lisp9-20200220.tgz from
	https://www.t3x.org/lsi/index.html and
	https://www.t3x.org/lisp9/index.html.

	The canonical source for this version is at
	https://github.com/ctarbide/lisp9.

	This version depends on cproto, from
	https://invisible-island.net/cproto/cproto.html.

	Nils M Holm has many books (and code) on LISP and
	other advanced topics on https://www.t3x.org/.

	The original README follows:

	****************************************************************


	LISP9 -- an experimental LISP system
	Nils M Holm, 2018, 2019
	In the public domain.

	If your country does not have a concept like the public
	domain, the Creative Common Zero (CC0) licence applies.
	See https://creativecommons.org/publicdomain/zero/1.0/

	In order to build LISP9, an ANSI C89 / ISO C90 compiler is
	needed. In addition, the rename() system call has to be
	present, but it can be removed from the code without any
	consequences other than the RENAME function not working.

	To build the LISP9 system, run "make". Without make, run

	cc -O2 -o ls9 ls9.c
	echo '(dump-image "ls9.image")' | ./ls9 -q

	To make sure that the system works properly, run "make test"
	or "./ls9 test.ls9".

	For a summary of command line options, run "./ls9 -h".

	To build an image containing the online help system, run

	echo "(save)" | ./ls9 -l src/help.ls9

	When starting LISP9 for the next time, you can then use

	,h,t          to view the table of contents
	,h,t chapter  to view the contents of a chapter
	,h  topic     to view the section about a given topic

	To build an image containing the online help system, the
	LAM disassembler, and the pretty printer (grinder), run

	echo "(save)" | \
	     ./ls9 -l src/help.ls9 -l src/disasm.ls9 -l src/grind.ls9

	To start the interpreter in interactive mode, run

	./ls9

	The interpreter prompt is a single "*". Expressions typed at
	the prompt will evaluate and print their results. The most
	recently printed result will be bound to the variable **, so
	you can reuse the result without typing it, e.g.:

	* (mapcar list '(a b c) '(1 2 3))
	((a 1) (b 2) (c 3))
	* (assq 'b **)
	(b 2)

	There are a few shortcuts that work only on the REPL:

	,c command   will pass "command" to the shell
	,h topic     will display sections of the manual (see above)
	,l file      will load "file.ls9".

	To end a LISP9 session, send an EOF marker (control-D on Unix)
	to the system or enter (quit).

lisp9's People

Contributors

ctarbide avatar

Stargazers

 avatar

Watchers

 avatar  avatar

lisp9's Issues

macOS compile errors

Dunno if you care about making this macOS compatible... but compiling with clang on macOS 12.2 with Apple Xcode command line tools I get this:

lisp9-ctarbide e% make
gcc -m32 -ggdb3 -O2 -std=c99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -Wdeclaration-after-statement -Wno-unused-parameter -pedantic -Werror -c ls9.c
size_t_aux.nw:71:9: error: 'SSIZE_MAX' macro redefined [-Werror,-Wmacro-redefined]
#define SSIZE_MAX       INT_MAX
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/limits.h:96:9: note: previous definition is here
#define SSIZE_MAX       LONG_MAX        /* max value for a ssize_t */
        ^
ls9-reader.nw:274:17: error: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wsign-conversion]
        while (isdigit(c)) {
               ~~~~~~~ ^
ls9-vm.nw:425:17: error: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wsign-conversion]
                Acc = isalpha(charval(Acc))? TRUE: NIL;
                      ~~~~~~~ ^~~~~~~~~~~~
ls9-types.nw:51:21: note: expanded from macro 'charval'
#define charval(n) (cadr(n))
                    ^~~~~~~
ls9-macros.nw:8:26: note: expanded from macro 'cadr'
#define cadr(x)         (Car[Cdr[x]])
                         ^~~~~~~~~~~
ls9-vm.nw:566:17: error: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wsign-conversion]
                Acc = islower(charval(Acc))? TRUE: NIL;
                      ~~~~~~~ ^~~~~~~~~~~~
ls9-types.nw:51:21: note: expanded from macro 'charval'
#define charval(n) (cadr(n))
                    ^~~~~~~
ls9-macros.nw:8:26: note: expanded from macro 'cadr'
#define cadr(x)         (Car[Cdr[x]])
                         ^~~~~~~~~~~
ls9-vm.nw:598:17: error: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wsign-conversion]
                Acc = isdigit(charval(Acc))? TRUE: NIL;
                      ~~~~~~~ ^~~~~~~~~~~~
ls9-types.nw:51:21: note: expanded from macro 'charval'
#define charval(n) (cadr(n))
                    ^~~~~~~
ls9-macros.nw:8:26: note: expanded from macro 'cadr'
#define cadr(x)         (Car[Cdr[x]])
                         ^~~~~~~~~~~
ls9-vm.nw:710:17: error: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wsign-conversion]
                Acc = isupper(charval(Acc))? TRUE: NIL;
                      ~~~~~~~ ^~~~~~~~~~~~
ls9-types.nw:51:21: note: expanded from macro 'charval'
#define charval(n) (cadr(n))
                    ^~~~~~~
ls9-macros.nw:8:26: note: expanded from macro 'cadr'
#define cadr(x)         (Car[Cdr[x]])
                         ^~~~~~~~~~~
6 errors generated.
make: *** [ls9.o] Error 1

There are also over 100 warnings(?) from cproto when trying to parse macOS header files, tripping over intrinsics like __asm and __compar. These might be harmless since the files ls9_protos.h and ls9.c are generated.

It looks like SSIZE_MAX comes from size_t_aux.nw where perhaps an#ifndef SSIZE_MAX would help. I added these in ls9.c to test that, and added some (int ) casts for charval used with is.... character functions and the compile succeeded.

The link failed since macOS no longer supports i386 mode. So I modified the Makefile to use WIDTH = -m64 and the build completed.

lisp9-ctarbide e% make    
gcc -m64 -ggdb3 -O2 -std=c99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -Wdeclaration-after-statement -Wno-unused-parameter -pedantic -Werror -c ls9.c
gcc -m64 -ggdb3 -O2 -std=c99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -Wdeclaration-after-statement -Wno-unused-parameter -pedantic -Werror -o ls9 ls9.o
CHMOD='chmod 0555' NOFAKE='tools/nofake' tools/nofake.sh -Rdump-image.sh \
		ls9.nw ls9-scripts.nw -odump-image.sh
Generate "dump-image.sh".
./dump-image.sh
All basic assertions passed!
t
lisp9-ctarbide e% 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.