Next: , Previous: External representation, Up: Formal syntax



7.1.3 Expressions

<expression> –> <variable>
     | <literal>
     | <procedure call>
     | <lambda expression>
     | <conditional>
     | <assignment>
     | <derived expression>
     | <macro use>
     | <macro block>

<literal> –> <quotation> | <self-evaluating>
<self-evaluating> –> <boolean> | <number>
     | <character> | <string>
<quotation> –> '<datum> | (quote <datum>)
<procedure call> –> (<operator> <operand>*)
<operator> –> <expression>
<operand> –> <expression>

<lambda expression> –> (lambda <formals> <body>)
<formals> –> (<variable>*) | <variable>
     | (<variable>+ . <variable>)
<body> –> <definition>* <sequence>
<sequence> –> <command>* <expression>
<command> –> <expression>

<conditional> –> (if <test> <consequent> <alternate>)
<test> –> <expression>
<consequent> –> <expression>
<alternate> –> <expression> | <empty>

<assignment> –> (set! <variable> <expression>)

<derived expression> –>
       (cond <cond clause>+)
     | (cond <cond clause>* (else <sequence>))
     | (case <expression>
         <case clause>+)
     | (case <expression>
         <case clause>*
         (else <sequence>))
     | (and <test>*)
     | (or <test>*)
     | (let (<binding spec>*) <body>)
     | (let <variable> (<binding spec>*) <body>)
     | (let* (<binding spec>*) <body>)
     | (letrec (<binding spec>*) <body>)
     | (begin <sequence>)
     | (do (<iteration spec>*)
           (<test> <do result>)
         <command>*)
     | (delay <expression>)
     | <quasiquotation>

<cond clause> –> (<test> <sequence>)
      | (<test>)
      | (<test> => <recipient>)
<recipient> –> <expression>
<case clause> –> ((<datum>*) <sequence>)
<binding spec> –> (<variable> <expression>)
<iteration spec> –> (<variable> <init> <step>)
    | (<variable> <init>)
<init> –> <expression>
<step> –> <expression>
<do result> –> <sequence> | <empty>

<macro use> –> (<keyword> <datum>*)
<keyword> –> <identifier>

<macro block> –>
     (let-syntax (<syntax spec>*) <body>)
     | (letrec-syntax (<syntax spec>*) <body>)
<syntax spec> –> (<keyword> <transformer spec>)