Provide a procedure to produce Modula-3 code out of type structures. Provide a procedure to generate procedure header Modula-3 code.
INTERFACEGenTypeCode ; IMPORT Formatter, Type; PROCEDURE ToText (t: Type.T; byName: BOOLEAN := TRUE): TEXT;
Return a textual representation of the type t. If byName = TRUE, and type T is named, then return the name. Otherwise return text for the delcaration of T. Note that even with byName = FALSE, typeNames will be used within the text for t's declaration
PROCEDURE ProcHeader (f : Formatter.T; procName : TEXT; sig : Type.Signature; suffix := ""; argPragmas: REF ARRAY OF TEXT := NIL );
Output onf
a header for a procedure with nameprocName
and a signature derived fromsig
. The signature differs fromsig
in that it's first argument is a self argument (self: T
), and its formal parameters' names are suffixed bysuffix
.pragmas
is a list of text for pragmas to precede arguments;pragma[i]
preceeds the ith parameter insig.formals[i]
.
END GenTypeCode.