Subject: Re: Splitting strings
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/03/13
Newsgroups: comp.lang.lisp
Message-ID: <6eaa3s$2b9ui@fido.asd.sgi.com>

Mike Dunn  <mike_dunn@mindlink.bc.ca> wrote:
+---------------
| FYI, the information is BASIC code read out of a text file using "read",
| which converts the next section of text into an object, stopping at
| whitespace.  An alternate solution would be to get read to stop at other
| things (a -, number, or a comma), but I'm not sure how to do this either.
+---------------

I'd suggest reading the original BASIC file as "lines" (strings) and
doing the first-pass lexical parsing yourself (yes, with an ad-hoc lexer),
then perhaps calling "read-from-string" to intern the Lisp data once
you've found the lexical boundaries of the tokens. IMHO, it's a lot
easier than trying to second-guess Lisp's "read" (and it's also easier
to handle the inevitable error cases)...

That's what I did when writing an assembler in Scheme [don't ask], and
the lexer wasn't very big, just a few dozen lines of code.


-Rob

-----
Rob Warnock, 7L-551		rpw3@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673 [New area code!]
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA