Forlan Manual


The Var Module


Synopsis

signature VAR
structure Var :> VAR

This module defines the abstract type of program variables.


Interface

type var
val beginsWithVar : (int * Lex.tok) list -> bool
val inputLabFromLabToks : (int * Lex.tok) list -> int * var * (int * Lex.tok) list
val fromString : string -> var
val input : string -> var
val toPP : var -> PP.pp
val toString : var -> string
val output : string * var -> unit
val compare : var Sort.total_ordering
val equal : var * var -> bool

Description

type var
The abstract type of program variables, consisting of all strings consisting of an initial letter, followed by a possibly empty sequence of letters or digits.

beginsWithVar lts
tests whether lts begins with a variable.

inputLabFromLabToks lts
tries to input a variable from lts, consuming as much of lts as possible, and returning the triple of the label in lts of the first letter of the variable, the variable itself, and the rest of lts. Issues an error message if this can't be done.

fromString s
inputs a variable from s.

input fil
inputs a variable from the file named by fil.

toPP v
returns a pretty-printing expression for v.

toString v
pretty-prints v to a string.

output(fil, v)
pretty-prints v to the file named by fil.

compare(v1, v2)
returns
  case Int.compare(size v1, size v2) of
       LESS    => LESS
     | EQUAL   => String.compare(v1, v2)
     | GREATER => GREATER


equal(v1, v2)
tests whether v1 and v2 are equal.


[ Top | Parent | Root | Contents | Index ]

Forlan Version 4.15
Copyright © 2022 Alley Stoughton