Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Compiler-compiler
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===CWIC=== In 1968β1970, Erwin Book, Dewey Val Schorre, and Steven J. Sherman developed CWIC.<ref name="CWIC" /> (Compiler for Writing and Implementing Compilers) at [[System Development Corporation]] [http://special.lib.umn.edu/findaid/xml/cbi00090-098.xml#series6 Charles Babbage Institute Center for the History of Information Technology (Box 12, folder 21)], CWIC is a compiler development system composed of three special-purpose, domain specific, languages, each intended to permit the description of certain aspects of translation in a straight forward manner. The syntax language is used to describe the recognition of source text and the construction from it to an intermediate [[Tree (data structure)|tree]] structure. The generator language is used to describe the transformation of the tree into appropriate object language. The syntax language follows Dewey Val Schorre's previous line of metacompilers. It most resembles TREE-META having [[Tree (data structure)|tree]] building operators in the syntax language. The unparse rules of TREE-META are extended to work with the object based generator language based on [[LISP 2]]. CWIC includes three languages: * '''Syntax''': Transforms the source program input, into list structures using grammar transformation formula. A parsed expression structure is passed to a generator by placement of a generator call in a rule. A [[Tree (data structure)|tree]] is represented by a list whose first element is a node object. The language has operators, '''<''' and '''>''', specifically for making lists. The colon ''':''' operator is used to create node objects. ''':ADD''' creates an ADD node. The exclamation '''!''' operator combines a number of parsed entries with a node to make a tree. Trees created by syntax rules are passed to generator functions, returning success or failure. The syntax language is very close to TREE-META. Both use a colon to create a node. CWIC's tree building exclamation !<number> functions the same as TREE-META's [<number>]. * '''Generator''': a named series of transforming rules, each consisting of an unparse, pattern matching, rule. and an output production written in a LISP 2 like language. the translation was to IBM 360 binary machine code. Other facilities of the generator language generalized output.<ref name="CWIC" /> * '''[[MOL-360]]''': an independent [[system programming language|mid level implementation language]] for the IBM System/360 family of computers developed in 1968 and used for writing the underlying support library. ==== Generators language ==== Generators Language had semantics similar to [[Lisp (programming language)|Lisp]]. The parse [[Tree (data structure)|tree]] was thought of as a recursive list. The general form of a Generator Language function is: <pre> function-name(first-unparse_rule) => first-production_code_generator (second-unparse_rule) => second-production_code_generator (third-unparse_rule) => third-production_code_generator ...</pre> The code to process a given [[Tree (data structure)|tree]] included the features of a general purpose programming language, plus a form: <stuff>, which would emit (stuff) onto the output file. A generator call may be used in the unparse_rule. The generator is passed the element of unparse_rule pattern in which it is placed and its return values are listed in (). For example: <pre> expr_gen(ADD[expr_gen(x),expr_gen(y)]) => <AR + (x*16)+y;> releasereg(y); return x; (SUB[expr_gen(x),expr_gen(y)])=> <SR + (x*16)+y;> releasereg(y); return x; (MUL[expr_gen(x),expr_gen(y)])=> . . . (x)=> r1 = getreg(); load(r1, x); return r1; ...</pre> That is, if the parse [[Tree (data structure)|tree]] looks like (ADD[<something1>,<something2>]), expr_gen(x) would be called with <something1> and return x. A variable in the unparse rule is a local variable that can be used in the production_code_generator. expr_gen(y) is called with <something2> and returns y. Here is a generator call in an unparse rule is passed the element in the position it occupies. Hopefully in the above x and y will be registers on return. The last transforms is intended to load an atomic into a register and return the register. The first production would be used to generate the 360 "AR" (Add Register) instruction with the appropriate values in general registers. The above example is only a part of a generator. Every generator expression evaluates to a value that con then be further processed. The last transform could just as well have been written as: <pre> (x)=> return load(getreg(), x); </pre> In this case load returns its first parameter, the register returned by getreg(). the functions load and getreg are other CWIC generators. ==== CWIC addressed [[domain-specific language]]s before the term [[domain-specific language]] existed ==== From the authors of CWIC: "A metacompiler assists the task of compiler-building by automating its non creative aspects, those aspects that are the same regardless of the language which the produced compiler is to translate. This makes possible the design of languages which are appropriate to the specification of a particular problem. It reduces the cost of producing processors for such languages to a point where it becomes economically feasible to begin the solution of a problem with language design."<ref name="CWIC" />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)