IDEA: LISP Interpreter
i've written a tutorial on lisp for the uninformed.
it's a fairly simple scripting language. here's an example:
(defun func1 (x)
(- x 4)
(+ x 3) )
(func1 (- (+ 3 5) (/ 3 7)))
3 + 5 = 8, 3 / 7 = 3/7
8 - 3/7 = 7 4/7
func1 is a user-defined function which adds 3 to whatever x is. the value returned is 10 4/7 (or whatever that is in decimal).
the last statement in a user-defined function is the value that is returned. func1 ignores (- x 4) because it doesn't really do anything.
lisp is named lisp because of its list variables and built in lisp manipulation functions. because implementing that would take too much time, list manipulation is not required.
here is what's required in the lisp interpreter (if voted for):
- it needs to work with nested lisp expressions, where a single expression is bounded by two parentheses. each expression returns some value
- you need to create some predefined functions like +, -, *, /, etc...
you know, the simple stuff.
- each program needs to be able to define functions like i showed above (using the defun statement). hint: unlike C functions, which does type-checking and other complicated stuff, the defun command should be more like the C #define command.
so, in other words:
this should become:
(defun func1 (x) (+ x 3))
which is easy to evaluate.
- each program should check the number of parentheses to help make sure there aren't any typos. this could be as simple as counting the number of '(', then counting the number of ')', and seeing if the numbers match
one last thing, not LISP-related:
if the search/replace program is voted for, you cannot use the string classes with it. that would just be too easy :D
If your intrested in lisp like languages one cool book I've found is
I havn't had enough time to read the whole thing (or halve)
I won't be able to participate now as summer is now ending and I will be very busy :(
However I'd still like to see people tackle this.