If you refer to the "Syntax Model" section of the reference (http://docs.racket-lang.org/reference/syntax-model.html), you'll see that Racket syntax is defined by two passes, called "read" and "expand".

The grammar you gave in your message is what I would call a "term"---it's anything that the read pass can turn into a syntax object. In other words, terms are what syntax objects represent.

The word "form" generally means any of the non-terminals of the Racket language that the macro expander cares about, such as "expression forms" and "definition forms". There are also "module-level forms", which include require and provide. There's a list of these nonterminals in the subsection "Fully Expanded Programs" (http://docs.racket-lang.org/reference/syntax-model.html#%28part._fully-expanded%29). You can think of the syntax of Racket roughly as that grammar with "or a macro that eventually expands into one of the above" added to every production there---except the one for "formals". The "formals" non-terminal doesn't correspond to an expansion context, nor do "module-path" or "raw-require-spec"; thus, they are not considered forms. Neither is something like "cond-clause", for example; it's just an auxiliary non-terminal for the "cond" macro.

To complicate matters, macros can also create new expansion contexts and thus new kinds of forms. For example, the class macro introduces "class-body forms", which include expressions and definitions as well as other syntaxes that are only significant immediately within class bodies, such as "init" and "abstract" forms.

Ryan


On 05/16/2014 12:28 PM, Norman Ramsey wrote:
Where would I find out, preferably in the Racket documentation,
the definition of what a 'form' is?  I'm thinking along these lines:

   A form is one of:
     - a symbol
     - a numeric literal
     - a string literal
     - ... possibly other literals? ...
     - a sequence of forms wrapped in one pair of parentheses

Is this the right idea?  Or is the word 'form' reserved only for
things wrapped in parentheses?


Norman


P.S. In the Racket documentation, I found the section on 'Syntactic
Forms', but I haven't found a definition of what a form is, and I
haven't found the word 'form' in the index.


____________________
   Racket Users list:
   http://lists.racket-lang.org/users


____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to