Next: , Previous: , Up: Formal syntax   [Index]


7.1.3 Expressions

The definitions in this and the following subsections assume that all the syntax keywords defined in this report have been properly imported from their libraries, and that none of them have been redefined or shadowed.

⟨expression⟩ → ⟨identifier⟩
  | ⟨literal⟩
  | ⟨procedure call⟩
  | ⟨lambda expression⟩
  | ⟨conditional⟩
  | ⟨assignment⟩
  | ⟨derived expression⟩
  | ⟨macro use⟩
  | ⟨macro block⟩
  | ⟨includer⟩


⟨literal⟩ → ⟨quotation⟩ | ⟨self-evaluating⟩

⟨self-evaluating⟩ → ⟨boolean⟩ | ⟨number⟩ | ⟨vector⟩ | ⟨character⟩ | ⟨string⟩ | ⟨bytevector⟩

⟨quotation⟩ → '⟨datum⟩ | (quote ⟨datum⟩)

⟨procedure call⟩ → (⟨operator⟩ ⟨operand⟩*)

⟨operator⟩ → ⟨expression⟩

⟨operand⟩ → ⟨expression⟩


⟨lambda expression⟩ → (lambda ⟨formals⟩ ⟨body⟩)

⟨formals⟩ → (⟨identifier⟩*) | ⟨identifier⟩ | (⟨identifier⟩+ . ⟨identifier⟩)

⟨body⟩ → ⟨definition⟩* ⟨sequence⟩

⟨sequence⟩ → ⟨command⟩* ⟨expression⟩

⟨command⟩ → ⟨expression⟩


⟨conditional⟩ → (if ⟨test⟩ ⟨consequent⟩ ⟨alternate⟩)

⟨test⟩ → ⟨expression⟩

⟨consequent⟩ → ⟨expression⟩

⟨alternate⟩ → ⟨expression⟩ | ⟨empty⟩


⟨assignment⟩ → (set! ⟨identifier⟩ ⟨expression⟩)


⟨derived expression⟩ → (cond ⟨cond clause⟩+)
  | (cond ⟨cond clause⟩* (else ⟨sequence⟩))
  | (case ⟨expression⟩ ⟨case clause⟩+)
  | (case ⟨expression⟩ ⟨case clause⟩* (else ⟨sequence⟩))
  | (case ⟨expression⟩ ⟨case clause⟩* (else => ⟨recipient⟩))
  | (and ⟨test⟩*)
  | (or ⟨test⟩*)
  | (when ⟨test⟩ ⟨sequence⟩)
  | (unless ⟨test⟩ ⟨sequence⟩)
  | (let (⟨binding spec⟩*) ⟨body⟩)
  | (let ⟨identifier⟩ (⟨binding spec⟩*) ⟨body⟩)
  | (let* (⟨binding spec⟩*) ⟨body⟩)
  | (letrec (⟨binding spec⟩*) ⟨body⟩)
  | (letrec* (⟨binding spec⟩*) ⟨body⟩)
  | (let-values (⟨mv binding spec⟩*) ⟨body⟩)
  | (let*-values (⟨mv binding spec⟩*) ⟨body⟩)
  | (begin ⟨sequence⟩)
  | (do (⟨iteration spec⟩*) (⟨test⟩ ⟨do result⟩) ⟨command⟩*)
  | (delay ⟨expression⟩)
  | (delay-force ⟨expression⟩)
  | (parameterize ((⟨expression⟩ ⟨expression⟩)*) ⟨body⟩)
  | (guard (⟨identifier⟩ ⟨cond clause⟩*) ⟨body⟩)
  | ⟨quasiquotation⟩
  | (case-lambda ⟨case-lambda clause⟩*)


⟨cond clause⟩ → (⟨test⟩ ⟨sequence⟩) | (⟨test⟩) | (⟨test⟩ => ⟨recipient⟩)

⟨recipient⟩ → ⟨expression⟩

⟨case clause⟩ → ((⟨datum⟩*) ⟨sequence⟩) | ((⟨datum⟩*) => ⟨recipient⟩)

⟨binding spec⟩ → (⟨identifier⟩ ⟨expression⟩)

⟨mv binding spec⟩ → (⟨formals⟩ ⟨expression⟩)

⟨iteration spec⟩ → (⟨identifier⟩ ⟨init⟩ ⟨step⟩) | (⟨identifier⟩ ⟨init⟩)

⟨case-lambda clause⟩ → (⟨formals⟩ ⟨body⟩)

⟨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⟩)


⟨includer⟩ → | (include ⟨string⟩+) | (include-ci ⟨string⟩+)


Next: Quasiquotations, Previous: External representations, Up: Formal syntax   [Index]