Attached please find a modern-expressions (NOT full sweet-expr, this
is just partial implementation) implementation.

Note that I've done some bit of trickery in reading in atoms (symbols,
numbers).  #-prefixed objects and "-prefixed objects are handled
directly by the built-in parser.

1.  On reaching # or ", call in the built-in parser.  Nothing we can
do about readtables, oh well.  This also means that multiline comments
will interact badly with sweet-reader.  Oh well oh well.

2.  Otherwise on reaching a place where atomic syntax could occur,
slurp in characters until we reach whitespace or one of our special
syntax characters: QUOTE, QUASIQUOTE, UNQUOTE, SPLICE (?),
LPAREN/RPAREN, LBRACKET/RBRACKET, LBRACE/RBRACE... any others we
should be wary about?  This is implemented by the function
read-atom-string.

3.  Run the built-in parser on the string.

Which brings me to: how portably can we assure that (1) the built-in
string parser will definitely use the built-in port parser (and won't
call our reader if we replace the reader via read, *current-reader*,
or current-reader) (2) if we can't portably assume that the built-in
string parser will use only the built-in port parser, how portably can
we assume some method of getting an input port from a string?
Remember to consider other Lisps, not just Scheme implementations.

--

I've done my best to keep the structure of the parser implementation
as near as possible to the structure of the parser I specified.  If
you can find ways to make the structure even nearer (modulo
restrictions caused by not-so-compliant scheme implementations, such
as older Guiles having problems with macros defined and used inside
begin), please do so.

Sincerely,
AmkG

Attachment: sweet-expr.scm
Description: Binary data

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to