[q-lang-users] Request to add new reserved words "quote" and "QUOTE" to Q
Brought to you by:
agraef
From: John C. <co...@cc...> - 2006-05-16 04:34:02
|
This is a request to make the identifiers "quote" and "QUOTE" reserved and illegal in Q 7.1 and future releases. In the interest of getting some interoperability between the Lisp family of languages and Q, I'm designing an S-expression representation of Q expressions -- not declarations or definitions, just expressions. Doing this permits a representation of a Q expression to be easily manipulated by Scheme or Common Lisp programs. The basic Q types are integers, floats, booleans, strings, files, symbols, applications, lists, and tuples. Of these, files are hopeless (there is no standardized representation of them). Integers, floats, strings, symbols, and tuples have clear S-expression representations (tuples are Scheme vectors or Common Lisp simple general vectors, in either case notated "#(a b c)". Booleans can be represented in S-expressions by the symbols "true" and "false", just as on the Q side; in Scheme, the special boolean values #t and #f can be mapped back and forth. Lists and applications, however, are both represented by lists in both Scheme and CL, and only context distinguishes them. By reserving the word "quote", we can use "(quote (a b c)) to represent a list and "(a b c)" to represent one or more Q applications (right associative as usual). Because Lisp is not case-sensitive, the internal representation of the symbol named "quote" may be either "quote" or "QUOTE", so both must be reserved in Q. If these words are not reserved, then the Q application "quote [a,b]" would have the same S-expression representation as "[a,b]". This should be a really trivial change to the compiler and interpreter that can be folded into 7.1, I think. -- John Cowan <co...@cc...> http://www.ccil.org/~cowan .e'osai ko sarji la lojban. Please support Lojban! http://www.lojban.org |