• Top
  • Abstract-syntax
  • Statement-fixtypes

Statement

Fixtype of Leo statements.

This is a tagged union type, introduced by fty::deftagsum.

Member Tags → Types
:let → statement-let
:const → statement-const
:assign → statement-assign
:return → statement-return
:for → statement-for
:if → statement-if
:console → statement-console
:block → statement-block
:finalize → statement-finalize
:increment → statement-increment
:decrement → statement-decrement

There are variable and constant declarations, assignments, return statements, loops, conditionals, console calls, and blocks.

We use arbitrary expressions on the left side of assignments, even though only a subset of expressions may be used: the subset is enforced by type checking.

We formalize conditionals as consisting of a sequence of branches (tests and expressions) and a final else block. The first branch contains the first condition and the then statements. Each successive branch contains the condition after an else if and the block following the additional then. The final else block is empty if there is no bare else at the end, i.e., if every else is followed by another if. There must be at least one branch; this is not captured in our abstract syntax, but delegated to static and dynamic semantics.

We formalize blocks as lists of statements. We do not introduce wrappers for blocks (aside from the tag :block in the statement fixtype).

Subtopics

Statement-case
Case macro for the different kinds of statement structures.
Statementp
Recognizer for statement structures.
Statement-for
Statement-equiv
Basic equivalence relation for statement structures.
Statement-if
Statement-increment
Statement-decrement
Statement-assign
Statement-return
Statement-let
Statement-kind
Get the kind (tag) of a statement structure.
Statement-finalize
Statement-const
Statement-console
Statement-block
Statement-fix
Fixing function for statement structures.
Statement-count
Measure for recurring over statement structures.