Hi Alex,
I hope not to spoil your fun but have you had a look at this:
Write Yourself a Scheme in 48 Hours
http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html
Regards,
titto
___
Haskell-Cafe mailing list
Hallo,
On 10/3/07, Pasqualino 'Titto' Assini [EMAIL PROTECTED] wrote:
Hi Alex,
I hope not to spoil your fun but have you had a look at this:
Write Yourself a Scheme in 48 Hours
http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html
Yes, I'm actually using it as a
Hallo,
For fun and learning I'm trying to parse R5RS Scheme with Parsec.
The code to parse lists follows:
--
-- Lists
--
parseLeftList :: Parser [SchDatum]
parseLeftList = do
char '('
many parseDatum = return . filter (/= SchAtmosphere)
parseDottedList :: [SchDatum] - Parser SchDatum
On Oct 2, 2007, at 9:52 , Alex Queiroz wrote:
(parseDottedList ls) | (parseProperList ls)
I've factored out the common left sub-expression in
parseLeftList. The problem is that ... is a valid identifier so when
inside the left of the list the parser sees a single dot, it tries to
match
Hallo,
On 10/2/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:
On Oct 2, 2007, at 9:52 , Alex Queiroz wrote:
(parseDottedList ls) | (parseProperList ls)
I've factored out the common left sub-expression in
parseLeftList. The problem is that ... is a valid identifier so when
On Oct 2, 2007, at 10:36 , Alex Queiroz wrote:
This does not work. The parser chokes in parseLeftList, because
it finds a single dot which is not the beginning of
Sorry, just woke up and still not quite tracking right, so I modified
the wrong snippet of code. The trick is to
Hallo,
On 10/2/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:
Sorry, just woke up and still not quite tracking right, so I modified
the wrong snippet of code. The trick is to wrap parseLeftList in a
try, so the parser retries the next alternative when it fails.
Since ... can
I don't know if this applies to Scheme parsing, but I find it's often
helpful to introduce a tokenizer into the parser to centralize the use
of try to one place::
type Token = String
tokRaw :: Parser Token
tokRaw = {- implement this yourself depending on language spec -}
tok :: Parser Token
tok
On Tue, Oct 02, 2007 at 11:36:52AM -0300, Alex Queiroz wrote:
Hallo,
On 10/2/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:
On Oct 2, 2007, at 9:52 , Alex Queiroz wrote:
(parseDottedList ls) | (parseProperList ls)
I've factored out the common left sub-expression in