Here's a tip for anyone who's thinking about writing their own language - plan it first. I know I should have. I've got a reasonable understanding of how Lisp works (i.e. evaluate everything inside the brackets recursively, and then process it) but I made some silly mistakes...
..Like evaluating the brackets each time I read them. For example, the program:-
(defvar lst (quote 1 2 3) ; <- "lst" now contains (1 2 3), correct.
(print (lst)) ; Error! I've processed "lst", but the function "1" (i.e. the first item in the list) is (obviously) unknown!
This is just one example. I'm going to start again. I've learnt a lot from my mistakes though, and my aim is to have a language with the best Lisp features like Macros, but more practical with simple functions to connect to databases etc...
No comments:
Post a Comment