Compiler Generators: What They Can Do, What They Might Do, by Mads Tofte

&') sort "action" ####################################### - .

12 the name do dS2T , where d stands for the LOOP definition. 4 The Compilers Generated by CERES 31 holds. This implication can be proved in a mathematical sense, assuming suitable definitions of the concepts involved. We shan do this in Chap. 3. 3 Compilers Written as Object Programs A "compiling definition" can be translated into an object program in a fairly straightforward way; all we really need to "execute" a compiling definition is elementary actions to handle the recursive calls and the comparison between the actual node of the syntax tree and the left-hand sides of the rules.

For each rule in cd, we have one sw-action with an action parameter corresponding to the rule's right-hand side. Each of the action parameters is terminated with a preturn action giving the return of a recursive descent call. CONPAR, NEXT). code (read); pcall (L. AFARGO, 1 . CONPAR, NEXT); pcaJl (L . AFARGO, 2. CONPAR, NEXT); addcode (write); finish& ; preturn ) ); sw (a;ny&. ide, # 13 # AFAR (newpars; pushconst (a;ny&); addcodepar (assign); preturn ) ); parseerror IN GO (L) ENDIT ) Fig. 5 The Compiler Generator 51 If the compiling definition contains product right-hand sides, some additional machinery is needed to select the proper alternatives.

Download PDF sample

Rated 4.32 of 5 – based on 3 votes
Posted In CategoriesCompilers