[plt-scheme] Student parsing problem

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Jun 2 17:27:06 EDT 2009

I just helped a student debug their program. It looked like this:

(define (function1 arg)
 ...
 )
`;;(html (body "Text"))

(define (function2 arg)
 ...)

(function2 1)

Naturally it is easy to tell that the problem is that ` finds the next
s-expression, even if there are comments and whitespace between it and
the next one; so function2 isn't really defined at all.

Now, it seems reasonable for this to be a problem that the user should
deal with in the Module and other higher languages. But you can get
the same problem in Beginner (w/ List Abbrevs):

(define (foo bar)
  1)
`;; Example

(define (zog zag)
  2)

(zog 1)

It would be nice, IMHO, if Beginner restricted ` and ' to be adjacent
and the standard syntax Scheme highlighter in other languages made
quoted expression visually distinct, but it doesn't appear that that
is easy to do without trying to do a full parse, plus there is the
obvious macro problem.

Jay

-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.