Mapping a different syntax to Lisp

Discussion of Common Lisp
adam33147
Posts: 20
Joined: Sat Aug 20, 2011 6:49 pm

Re: Mapping a different syntax to Lisp

Post by adam33147 » Sun Sep 04, 2011 10:21 am

This is turning out to be alot tougher then I thought. I want to make the syntax better. I have the concepts, but implemeting them is really hard.
For example, the following

Code: Select all

defun plus (a,b)
 {a + b}

defun minus (a,b)
 {a - b}
Could be implemented if the {} are interpreted to mean a list with the opening bracket that snaps back to a pair of newlines (this would also end the expression, so the user doesn't have to put the comma after). My latest insight is to use a tagging mechanism that tags the elements of the parsed tree ..ie..conses a var with value (gensym "SNAP-TO-NEWLINE") on the beggining of a curly bracketed list for example, or the sets newline and return marcocharacters to be a var with value (gensym "NEWLINE") for another example. These can be filtered out at before evaluation, but could be keys for the intepreter.

I need to a way to deal with trees on this level. I think that the tagged element tree manipulation program is the program I need to write before I can write the syntax mapping. But my thinking on what this program would be is very fuzzy. I guess it would be like a program that would allow you to implement an interpreter, then you could use it to implement your interpreter. Then I could use it to implement this interpreter. I think it certainly seems usefull. I is a good exercise to build tool that allows you to approach a problem in a new way.

Post Reply