Re: Designing Lisp from scratch
Robbert Haarman <[email protected]> Fri, 23 Mar 2007 14:58:59 +0100
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Mar 23, 2007 at 07:22:48AM -0500, Shriram Krishnamurthi wrote: > >I guess the main reason you may have a hard time finding lex/yacc > >parsers for Lisp is that Lisp parsers are built into every Lisp system. > >Thus, if you want to parse Lisp code, you just use Lisp and say (read). > > Bzzzt. > > READ does not *parse*. Parsing is regarded as the process of > distinguishing valid terms from invalid terms, accounting for the > context-sensitive (and more) constraints of the language. What READ > does is..."read": it produces an intermediate language of terms that > do not fully perform this distinction: that is, a term rejected by > READ is illegal, but one not rejected may also be illegal. E.g.: The > following terms are not valid Scheme (or perhaps they are in some > bizarre Scheme, but pretend they aren't): > > (lambda (x)) > (define (f 5) 3) > > but they do pass READ. It is some other tool, the parser, that > distinguishes these from the valid terms of the language. This tool > is hidden from the user of most Scheme systems. Hmm. Would it not be valid to call what READ does "parsing" and what this "other tool" does semantic analysis? Regards, Bob -- The reward for a job well done is more work.
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGA90jfb9wcmD+WN4RAgcHAJ9XEN7ue3KNiZSD1QPSSWJuDweZ9ACgtppf 7xBAAyEpkHFgaCwsEZPhxjo= =ab2Y -----END PGP SIGNATURE-----