Str Module
signature STR
structure Str :> STR
This module provides operations on Forlan strings, i.e., lists of Forlan symbols.
type str = Sym.sym list
val possBeginsWithStr : (int * Lex.tok) list -> bool
val inputFromLabToks : (int * Lex.tok) list -> str * (int * Lex.tok) list
val fromString : string -> str
val input : string -> str
val toPP : str -> PP.pp
val toString : str -> string
val output : string * str -> unit
val last : str -> Sym.sym
val allButLast : str -> str
val compare : str Sort.total_ordering
val equal : str * str -> bool
val alphabet : str -> Sym.sym Set.set
val renameAlphabet : str * SymRel.sym_rel -> str
val prefix : str * str -> bool
val suffix : str * str -> bool
val substr : str * str -> bool
val power : str * int -> str
val removePrefix : str * str -> str option
val removeSuffix : str * str -> str option
val jforlanValidate : string -> unit
val jforlanPretty : string -> unit
type str = Sym.sym list
In the concrete syntax for strings, the empty string is written as %, and a nonempty string [a1, ... an] is written as a1 ... an.
possBeginsWithStr lts
lts begins with a symbol or % (Lex.Perc), making it possible that a Forlan string could be parsed from lts.
inputFromLabToks lts
lts, consuming as much of lts as possible, and returning the pair of that string and the rest of lts. Issues an error message if this can't be done.
fromString s
s.
input fil
fil.
toPP x
x.
toString x
x to a string.
output(fil, x)
x to the file named by fil.
last x
x. Raises Empty if x is empty.
allButLast x
x. Raises Empty if x is empty.
compare
val compare = Set.compareList Sym.compareThis ordering first uses the length of strings (shorter is smaller), and then uses the lexicographic ordering on equal length strings.
equal(x, y)
x and y are equal.
alphabet x
x.
renameAlphabet(x, rel)
x using the bijection rel. Issues an error message if rel is not a bijection from a superset of the alphabet of x to some set.
prefix(x, y)
x is a prefix of y.
suffix(x, y)
x is a suffix of y.
substr(x, y)
x is a substring of y.
power(x, n)
x to the power n. Issues an error message if n is negative.
removePrefix(x, y)
x is a prefix of y, then removePrefix returns SOME z, where z is the result of removing x from the beginning of y. Otherwise, removePrefix returns NONE.
removeSuffix(x, y)
x is a suffix of y, then removeSuffix returns SOME z, where z is the result of removing x from the end of y. Otherwise, removeSuffix returns NONE.
jforlanValidate
jforlanPretty
Forlan Version 4.15
Copyright © 2022 Alley Stoughton