package codex
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=bc7266a140c6886add673ede90e335d3
sha512=8da42c0ff2c1098c5f9cb2b5b43b306faf7ac93b8f5ae00c176918cee761f249ff45b29309f31a05bbcf6312304f86a0d5a000eb3f1094d3d3c2b9b4c7f5c386
doc/codex.while_ast/While_ast/index.html
Module While_astSource
Abstract syntax for the while language
The aexp type represents integer-valued expressions in the While language. It includes literal constants and has three basic binary operations: addition, subtraction, and multiplication. Each constructor takes one or two sub-expressions of type aexp, allowing arbitrarily nested arithmetic trees (for example, (x + 2) * (y - 1)).
The bexp boolean expression captures logical predicates used in conditionals and loops. It provides the Boolean constants (True, False), comparison operators over arithmetic expressions -- equality (Eq), less-than-or-equal (Le), and greater-than (Ge) -- as well as logical negation (Not) and conjunction (And).
With nesting, one can form complex expressions such as (v <= 5 && !(v == 0)).
type stmt = | Skip| Assign of Var.t * aexp| Seq of stmt * stmt| If of bexp * stmt * stmt| While of bexp * stmt(*Finally, the
*)stmttype defines the statements of the While language.Skipis a no operation;Assignupdates a variable from an arithmetic expression;Seqcomposes two commands sequentially;Ifchooses one of two branches based on a boolean test; andWhilerepeatedly executes its body while a condition holds.