home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / languages / progs / iconv8_1 / Docs / Tr90-4 < prev    next >
Encoding:
Text File  |  1990-07-19  |  59.2 KB  |  1,963 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.               Variant Translators for Version 8 of
  15.                               Icon*
  16.  
  17.  
  18.                         Ralph E. Griswold
  19.                          Kenneth Walker
  20.  
  21.  
  22.  
  23.                             TR 90-4a
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.          January 1, 1990; last revised February 17, 1990
  50.  
  51.  
  52.                  Department of Computer Science
  53.  
  54.                     The University of Arizona
  55.  
  56.                       Tucson, Arizona 85721
  57.  
  58.  
  59.  
  60.  
  61. *This work was supported by the National Science Foundation under
  62. Grants CCR-8713690 and CCR-8901573.
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.               Variant Translators for Version 8 of
  77.                               Icon
  78.  
  79.  
  80.  
  81.  
  82. 1.__Introduction
  83.  
  84.    A preprocessor, which translates text from source language A
  85. to source language B,
  86.  
  87.         A -> B
  88.  
  89. is a popular and effective means of implementing A, given an
  90. implementation of B.  B is referred to as the target language.
  91. Ratfor [1] is perhaps the best known and most widely used example
  92. of this technique, although there are many others.
  93.  
  94.    In some cases A is a variant of B.  An example is Cg [2], a
  95. variant of C that includes a generator facility similar to Icon's
  96. [3].  Cg consists of C and some additional syntax that a prepro-
  97. cessor translates into standard C. A run-time system provides the
  98. necessary semantic support for generators. Note that the Cg
  99. preprocessor is a source-to-source translator:
  100.  
  101.         Cg -> C
  102.  
  103. where Cg differs from C only in the addition of a few syntactic
  104. constructs.  This can be viewed as an instance of a more general
  105. paradigm:
  106.  
  107.         A+ -> A
  108.  
  109.  
  110.    The term ``translator'' is used here in the general sense, and
  111. includes both source-to-source translators, such as preproces-
  112. sors, and source-to-object translators, such as compilers.  In
  113. practice, the application of a source-to-source translator
  114. (preprocessor) may be followed by the application of a source-
  115. to-object translator (compiler). The combination is, of course,
  116. also a translator.
  117.  
  118.    The term ``variant translator'' is used here to refer to a
  119. translator that differs in its action, in some respect, from a
  120. standard one for a language. The applications described in this
  121. report relate to source-to-source translators, although the term
  122. ``preprocessor'' is too restrictive to describe all of them.
  123.  
  124.    There are many uses for variant translators. Some of them are:
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                               - 1 -
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.      + the addition of syntactic constructions to produce a
  140.        superset of a language, as in the case of Cg
  141.  
  142.      + the deletion of features in order to subset a language
  143.  
  144.      + the translation of one source language into another [4]
  145.  
  146.      + the addition of monitoring code, written in the target
  147.        language
  148.  
  149.      + the insertion of termination code to output monitoring
  150.        data
  151.  
  152.      + the insertion of initialization code to incorporate addi-
  153.        tional run-time facilities
  154.  
  155.      + the insertion of code for debugging and checking purposes
  156.        [5,6]
  157.  
  158. Note that in several cases, the translations can be characterized
  159. by
  160.  
  161.         A -> A
  162.  
  163. The input text and the output text may be different, but they are
  164. both in A.  Both the input and the output of the variant transla-
  165. tor can be processed by a standard translator for the target
  166. language A.
  167.  
  168.    One way to implement a variant translator is to modify a stan-
  169. dard source-to-object translator, avoiding the preprocessor. This
  170. approach may or may not be easy, depending on the translator. In
  171. general, it involves modifying the code generator, which often is
  172. tricky and error prone. Furthermore, if the variant is an experi-
  173. ment, the effort involved may be prohibitive.
  174.  
  175.    The standard way to produce a variant translator is the one
  176. that is most often used for preprocessors in general, including
  177. ones that do not fit the variant translator paradigm - writing a
  178. stand-alone program in any convenient language. In the case of
  179. Ratfor, the preprocessor is written in Ratfor, providing the
  180. advantages of bootstrapping.
  181.  
  182.    This approach presents several problems. In the first place,
  183. writing a complete, efficient, and correct preprocessor is a sub-
  184. stantial undertaking. In experimental work, this effort may be
  185. unwarranted, and it is common to write the preprocessor in a
  186. high-level language, handling only the variant portion of the
  187. syntax, leaving the detection of errors to the final translator.
  188. Such preprocessors have the virtue of being easy to produce, but
  189. they often are slow, frequently unfaithful to the source
  190. language, and the failure to parse the input language completely
  191. may lead to mysterious results when errors are detected, out of
  192. context, by the final translator.
  193.  
  194.  
  195.  
  196.                               - 2 -
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.    Modern tools such as Lex [7] and Yacc [8], that operate on
  206. grammatical specifications, have made the production of compilers
  207. (and hence translators in general) comparatively easy and have
  208. removed many of the sources of error that are commonly found in
  209. hand-tailored translators. Nonetheless, the construction of a
  210. translator for a large and complicated language is still a sub-
  211. stantial undertaking.
  212.  
  213.    If, however, a translator already exists for a language that
  214. is based on the use of such tools, it may be easy to produce a
  215. variant translator that is efficient and demonstrably correct by
  216. modifying grammatical specifications.  The key is the use of
  217. these tools to produce a source-to-source translator, rather than
  218. producing a source-to-object translator.  This technique was used
  219. in Cg. An existing Yacc specification for the C compiler was
  220. modified to generate C source code instead of object code. The
  221. idea is a simple one, but it has considerable utility and can be
  222. applied to a wide range of situations.
  223.  
  224.    This report describes a system that uses this approach for the
  225. construction of variant translators for Icon.  This system
  226. presently runs only under UNIX systems with a large amount of
  227. memory.  The reader should have a general knowledge of Icon,
  228. Yacc, C, and UNIX.
  229.  
  230.  
  231. 2.__Overview_of_Variant_Translators_for_Icon
  232.  
  233.    The heart of the system for constructing variant translators
  234. for Icon consists of an ``identity translator''.  The output of
  235. this identity translator differs from its input only in the
  236. arrangement of nonsemantic ``white space'' and in the insertion
  237. of semicolons between expressions, which are optional in some
  238. places in Icon programs.
  239.  
  240.    The identity translator uses the same Yacc grammar as the reg-
  241. ular Icon translator, but uses different semantic actions. These
  242. semantic actions are cast as macro definitions in the grammar,
  243. which are expanded before the grammar is translated by Yacc into
  244. a parser. One set of macros is supplied for the regular Icon
  245. translator and another set is supplied for the identity transla-
  246. tor.  The macros used by the identity translator echo the input
  247. text, producing source-code output. In addition to the grammar,
  248. other code is shared between the two translators, insuring a high
  249. degree of consistency between the two systems.
  250.  
  251.    A variant translator is created by first creating an identity
  252. translator and then modifying it. There is a shell script for
  253. producing identity translators and associated support software to
  254. simply the process of making modifications.  This support
  255. software allows macro definitions to be changed via specification
  256. files, minimizing the clerical work needed to vary the format of
  257. the output. There also is a provision for including user func-
  258. tions in the parser, so that more complicated operations can be
  259.  
  260.  
  261.  
  262.                               - 3 -
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271. written in C. Finally, the grammar for the identity translator
  272. can be modified in order to make structural changes in the syn-
  273. tax.
  274.  
  275.    The following sections describe this system in more detail and
  276. include a number of examples of its use.
  277.  
  278.  
  279. 3.__The_Grammar_for_the_Icon_Identity_Translator
  280.  
  281.    The Icon grammar is listed in Appendix A. Many variant trans-
  282. lators can be constructed without modifying this grammar, and
  283. minor modifications can be made to it without a detailed
  284. knowledge of its structure. Knowledge of a few aspects of this
  285. grammar are important, however, to understanding the translation
  286. process.
  287.  
  288.    There are two types of semantic actions. The semantic action
  289. for a declaration outputs text. The semantic action for a com-
  290. ponent of a declaration, such as an identifier list or an expres-
  291. sion, assigns a string to the Yacc attribute for the component.
  292. Declarations are parsed by the production:
  293.  
  294.         decl    : record {Recdcl($1);} ;
  295.                 | proc {Procdcl($1);} ;
  296.                 | global {Globdcl($1);} ;
  297.                 | link {Linkdcl($1);} ;
  298.  
  299. The non-terminals record, proc, global, and link each produce a
  300. string and the corresponding macro Recdcl, Procdcl, Globdcl, or
  301. Linkdcl prints the string.
  302.  
  303.    Because the grammar is used for both the regular Icon transla-
  304. tor and the variant translator system, the macro calls must be
  305. more general than what is required for either one alone. Consider
  306. the production for global:
  307.  
  308.         global  : GLOBAL {Global0($1);} idlist  {Global1($1, $2, $3);} ;
  309.  
  310. The macro Global0 is needed in the regular translator, but per-
  311. forms no operation in the identity translator. The macro Global1
  312. does the work in the identity translator; it concatenates "global
  313. " with the string produced by idlist, and this new string becomes
  314. the result of this production. The macro Global1 is passed $1,
  315. $2, and $3 even though it only uses $3. This is done for general-
  316. ity.
  317.  
  318.    The rules and the definitions that construct and output
  319. strings are provided as part of the identity translator. When a
  320. variant translator is constructed, changes are necessary only in
  321. situations in which the input is not to be echoed in the output.
  322.  
  323.    Deletions from the standard syntax can be accomplished by
  324. changing macro definitions to produce error messages instead of
  325.  
  326.  
  327.  
  328.                               - 4 -
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. output text. It is generally better, however, to delete rules
  338. from the grammar, so that all syntactic errors in the input are
  339. handled in the same way, by Yacc.
  340.  
  341.    Modifications and additions to the standard grammar require a
  342. more thorough understanding of the structure of the grammar.
  343.  
  344.  
  345. 4.__Macro_Definitions
  346.  
  347.    The purpose of using macro calls in the semantic actions of
  348. the grammar is to separate the structure of the grammar from the
  349. format of the output and to allow the output format to be speci-
  350. fied without modification of the grammar.
  351.  
  352.    The macro definitions for declarations are all the same. For
  353. example the definition of Global for the identity translator is:
  354.  
  355.         #define Globdcl(x)if (!nocode) treeprt(x); treeinit()
  356.  
  357. The variable nocode is set when an error is detected during pars-
  358. ing.  This helps prevent the variant translator from generating a
  359. program with syntax errors. The reason for doing this is that the
  360. output of a variant translator is usually piped directly into the
  361. regular Icon translator. If syntax errors were propagated, two
  362. error messages would result: one from the variant translator and
  363. one from the Icon translator. The message from the variant trans-
  364. lator is the one that is wanted because it references the line
  365. number of the original source whereas the message from the Icon
  366. translator references the line number of the generated source.
  367.  
  368.    The function treeprt prints a string and the function treeinit
  369. reclaims storage. See the Section 5 for details of string
  370. representation.
  371.  
  372. 4.1__Specifications_for_Macros
  373.  
  374.    The macro definitions for expressions produce strings, gen-
  375. erally resulting from the concatenation of strings produced by
  376. other rules.  In order to simplify the definition of macros, a
  377. specification format is provided.  Specifications are processed
  378. by a program that produces the actual definitions.  For example,
  379. the macro While1 is used in the rule
  380.  
  381.         WHILE expr DO expr {While1($1,$2,$3,$4);} ;
  382.  
  383. A specification for this macro to produce an identity translation
  384. is:
  385.  
  386.         While1(w,x,y,z)     "while " x        " do "   z
  387.  
  388. Tabs separate the components of the specification. The first com-
  389. ponent is the prototype for the macro call, which may include
  390. optional arguments enclosed in parentheses as illustrated by the
  391.  
  392.  
  393.  
  394.                               - 5 -
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. example above. The remaining components are the strings to be
  404. concatenated with the result being assigned to the Yacc pseudo-
  405. variable $$.
  406.  
  407.    Specification lines that begin with # or which are empty are
  408. treated as comments.  A set of lines delineated by %{ and %} are
  409. copied unchanged.  The ``braces'' %{ and %} must each occur alone
  410. on a separate line; these two delimiting lines are not copied.
  411. This feature allows the inclusion of actual macro definitions, as
  412. opposed to specifications, and the inclusion of C definitions.
  413. The standard macro definitions supplied for the identity transla-
  414. tor include examples of these features. These definitions are
  415. listed in Appendix B.
  416.  
  417.    Definitions can be changed by modifying the standard ones or
  418. by adding new definitions. In the case of duplicate definitions,
  419. the last one holds.  Definitions can be provided in several
  420. files, so variant definitions can be provided in a separate file
  421. that is processed after the standard definitions. See Sec. 8.
  422.  
  423.    Definitions can be deleted by providing a specification that
  424. consists only of a prototype for the call. For example, the
  425. specification
  426.  
  427.         While1()
  428.  
  429. deletes the definition for While1. This is a convenient way to
  430. insure a macro is undefined. It is usually used along with the
  431. copy feature to introduce macro definitions that cannot be gen-
  432. erated by the specification system.  For example, the following
  433. specifications eliminate reclamation of storage, preserving
  434. strings between declarations.
  435.  
  436.         Globdcl()
  437.         Linkdcl()
  438.         Procdcl()
  439.         Recdcl()
  440.         %{
  441.         #define Globdcl(x)if (!nocode) treeprt(x);
  442.         #define Linkdcl(x)if (!nocode) treeprt(x);
  443.         #define Procdcl(x)if (!nocode) treeprt(x);
  444.         #define Recdcl(x)if (!nocode) treeprt(x);
  445.         %}
  446.  
  447.  
  448. 4.2__Macros_for_Icon_Operators
  449.  
  450.    As shown in Appendix A, there is a distinct macro name for
  451. each Icon operator.  For example, Blim(x,y,z) is the macro for a
  452. limitation expression,
  453.  
  454.         expr1 \ expr2
  455.  
  456. Note that the parameter y is the operator symbol itself.  To
  457.  
  458.  
  459.  
  460.                               - 6 -
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469. avoid having to know the names of the macros for the operators,
  470. specifications allow the use of operator symbols in prototypes.
  471. The symbols are automatically replaced by the appropriate names.
  472. Thus
  473.  
  474.         \(x,y,z)
  475.  
  476. can be used in a specification in place of
  477.  
  478.         Blim(x,y,z)
  479.  
  480. Unary operators are similar. For example, Uqmark(x,y), which is
  481. the macro for ?expr, can be specified as ?(x,y). In this case the
  482. parameter x is the operator symbol.
  483.  
  484.    In most cases, all operators of the same kind are translated
  485. in the same way. Since Icon has many operators, a generic form of
  486. specification is provided to allow the definition of all opera-
  487. tors in a category to be given by a single specification. In a
  488. specification, a string of the form <type> indicates a category
  489. of operators. The categories are:
  490.  
  491.         <uop>   unary operators, except as follows
  492.         <ucs>   control structures in unary operator format
  493.         <bop>   binary operators, except as follows
  494.         <aop>   assignment operators
  495.         <bcs>   control structures in binary operator format
  496.  
  497. The category <ucs> consists only of |.  The category <bcs> con-
  498. sists of ?, |, !, and \.
  499.  
  500.    For example, the specification for binary operators for iden-
  501. tity translations is
  502.  
  503.         <bop>(x,y,z)        x        " <bop> "         z
  504.  
  505. This specification results in the definition for every binary
  506. operator: +(x,y,z), -(x,y,z), and so on. In such a specification,
  507. every occurrence of <bop> is replaced by the corresponding opera-
  508. tor symbol. Note that blanks are necessary to separate the binary
  509. operator from its operands. Otherwise,
  510.  
  511.         i * *s
  512.  
  513. would be translated into
  514.  
  515.         i**s
  516.  
  517. which is equivalent to
  518.  
  519.         i ** s
  520.  
  521.  
  522.    The division of operators into categories is based on their
  523.  
  524.  
  525.  
  526.                               - 7 -
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535. semantic properties. For example, a preprocessor may translate
  536. all unary operators in the same way, but translate the repeated
  537. alternation control structure into a programmer-defined control
  538. operation [9].
  539.  
  540.  
  541. 5.__String_Handling
  542.  
  543.    Strings are represented as binary trees in which the leaves
  544. contain pointers to C strings. The building of these trees can be
  545. thought of as doing string concatenation using lazy evaluation.
  546. The concatenation operation just creates a new root node with its
  547. two operands as subtrees.  The real concatenation is only done
  548. when the strings are written out. Another view of this is that
  549. concatenation builds a list of strings with the list implemented
  550. as a binary tree. This view allows ``strings'' to be treated as a
  551. list of tokens. This approach is useful in more complicated
  552. situations where there is a need to distinguish more than just
  553. syntactic structures. For example, the head of the main procedure
  554. can be distinguished from the heads of other procedures by look-
  555. ing at the second string in the list for the procedure declara-
  556. tion.
  557.  
  558.    Strings come from three sources during translation: strings
  559. produced by the lexical analyzer, literal strings, and strings
  560. produced by semantic actions. The lexical analyzer produces
  561. nodes.  The cases where the nodes that are produced by the lexi-
  562. cal analyzer are of interest occur where strings are recognized
  563. for identifiers and literals - the tokens IDENT, STRINGLIT,
  564. INTLIT, REALIT, and CSETLIT.  These nodes contain pointers to the
  565. strings recognized. (The actual strings are stored in a string
  566. space and remain there throughout execution of the translator.)
  567. These nodes can be used directly as a tree (of one node) of
  568. strings. Other nodes produced by the lexical analyzer, for exam-
  569. ple those for operators, do not contain strings. However, all of
  570. these nodes contain line and column numbers referring to the
  571. location of the token in the source text. This line and column
  572. information can be useful in variant translators that need to
  573. produce output that contains position information from the input.
  574.  
  575.    A literal string must be coerced into a tree of one node.
  576. This is done with the C function
  577.  
  578.         q(s)
  579.  
  580. This is handled automatically when macros are produced from
  581. specifications.  For example, the specification
  582.  
  583.         Fail(x) "fail"
  584.  
  585. is translated into the macro
  586.  
  587.         #define Fail(x) $$ = q("fail")
  588.  
  589.  
  590.  
  591.  
  592.                               - 8 -
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.    Most semantic actions concatenate two or more strings and pro-
  602. duce a string.  They use the C function
  603.  
  604.         cat(n, t1,t2, ...,tn)
  605.  
  606. which takes a variable number of arguments and returns a pointer
  607. to the concatenated result. The first argument is the number of
  608. strings to be concatenated. The other arguments are the strings
  609. in tree format. The result is also in tree format.
  610.  
  611.    As an example, the specification
  612.  
  613.         While1(w,x,y,z)     "while " x        " do "   z
  614.  
  615. produces the definition
  616.  
  617.         #define While1(w,x,y,z) $$ = cat(4,q("while "),x,q(" do "),z)
  618.  
  619.  
  620.    Another function, item(t, n), returns the nth node in the
  621. ``list'' t.  For example, the name of a procedure is contained in
  622. the second node in the list for the procedure declaration (see
  623. Appendix A). Thus, if the procedure heading list is the value of
  624. head, item(head, 2) produces the procedure name.
  625.  
  626.    There are three macros that produce values associated with a
  627. node.  Str0() produces the string. For example, code conditional
  628. on the main procedure could be written as follows:
  629.  
  630.         if (strcmp(Str0(item(head,2)),"main") == 0) {
  631.                   .
  632.                   .
  633.                   .
  634.            }
  635.  
  636.  
  637.    As this example illustrates, semantic actions may be too com-
  638. plicated to be represented conveniently by macros. In such cases
  639. parser functions can be used. A file is provided for such func-
  640. tions. See Section 10 for an example.
  641.  
  642.    The macros Line and Col produce the source-file line number
  643. and column, respectively, of the place where the text for the
  644. node begins. The use of these attributes is illustrated in Sec-
  645. tion 10.
  646.  
  647.    In some sophisticated applications, variant translators may
  648. need other capabilities that are available in the translator sys-
  649. tem. For example, if a function produces a string, it may be
  650. necessary place this string in a place that survives the function
  651. call.  The Icon translator has a string allocation facility that
  652. can be used for this purpose: the free space begins at strfree
  653. and putident(n) installs a string of length n there. The use of
  654. such facilities requires more knowledge of the translator system
  655.  
  656.  
  657.  
  658.                               - 9 -
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667. than it is practical to provide here. Persons with special needs
  668. should study the translator in more detail.
  669.  
  670.  
  671. 6.__Modifying_Lexical_Components_of_the_Translator
  672.  
  673.    The lexical analyzer for Icon is written in C rather than in
  674. Lex in order to make it easier to perform semicolon insertion and
  675. other complicated tasks that occur during lexical analysis.
  676. Specification files are used to build portions of the lexical
  677. analyzer, making it easy to modify.  The three kinds of changes
  678. that are needed most often are the addition of new keywords,
  679. reserved words, and operators.
  680.  
  681.    The identity translator accepts any identifier as a keyword,
  682. leaving its resolution to subsequent processing by the Icon
  683. translator. Nothing need be done to add a new keyword except for
  684. processing it properly in the variant translator.
  685.  
  686.    The specification file tokens.txt contains a list of all
  687. reserved words and operator symbols.  Each symbol has associated
  688. flags that indicate whether it can begin or end an expression.
  689. These flags are used for semicolon insertion.
  690.  
  691.    To add a new reserved word, insert it in proper alphabetical
  692. order in the list of reserved words in tokens.txt and give it a
  693. new token name.  To add a new operator, insert it in the list of
  694. operators in tokens.txt (order there is not important) and give
  695. it a new token name.  The new token names must be added to the
  696. grammar. See Appendix A.
  697.  
  698.    The addition of a new operator also requires modifying the
  699. specification of a finite-state automaton, optab.txt.  Its struc-
  700. ture is straightforward.
  701.  
  702.  
  703. 7.__Modifying_Yacc
  704.  
  705.    Before building a variant translator, it may be necessary to
  706. modify Yacc, since the version of Yacc that normally is distri-
  707. buted with UNIX does not provide enough space to process Icon's
  708. grammar.  To build a version of Yacc with more space, edit the
  709. Yacc source file dextern and change the definition of MEMSIZE in
  710. the HUGE section to
  711.  
  712.         #define MEMSIZE 22000
  713.  
  714. and use
  715.  
  716.         #define HUGE
  717.  
  718. in files. Then rebuild Yacc.
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                              - 10 -
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733. 8.__Building_a_Variant_Translator
  734.  
  735.    The steps for setting up the directory structure for a variant
  736. translator are:
  737.  
  738.      +  create a directory for the translator
  739.  
  740.      +  make that directory the current directory
  741.  
  742.      +  execute the shell script icon_vt supplied with Version 8
  743.         of Icon
  744.  
  745. For example, if the variant translator is to be in the directory
  746. xtran and Icon is installed in /usr/icon/v8, the following com-
  747. mands will build the variant translator:
  748.  
  749.         mkdir xtran
  750.         cd xtran
  751.         /usr/icon/v8/icon_vt
  752.  
  753.  
  754.    The shell script icon_vt creates a number of files in the new
  755. directory and in two sub-directories: itran and h.  The files
  756. that comprise a variant translator are listed in Appendix C.
  757. Unless changes to the lexical analyzer are needed, at most three
  758. files need to be modified to produce a new translator:
  759.  
  760.         variant.defsvariant macro definitions (initially empty)
  761.         variant.c   parser functions (initially empty)
  762.         itran/icon_g.cYacc grammar for Icon
  763.  
  764. A non-empty variant.c usually requires #include files to provide
  765. needed declarations and definitions. See the example that fol-
  766. lows.
  767.  
  768.    The translator make file, itran/Makefile, is listed in Appen-
  769. dix D.  The make file in the main translator directory just
  770. insures that the program define has be compiled and then does a
  771. make in the itran directory.  Performing a make in the itran
  772. directory first combines variant.defs with the standard macro
  773. definitions (in ident.defs) and processes them to produce the
  774. definition file, itran/gdefs.h. The C preprocessor is then used
  775. to expand the macros in itran/icon_g.c using these definitions
  776. and the result, after some ``house keeping'', is put in
  777. itran/expanded.g. Next, Yacc uses the grammar in itran/expanded.g
  778. to build a new parser, parse.c.  There are over 200 shift/reduce
  779. conflicts in the identity translator.  All of these conflicts are
  780. resolved properly.  More conflicts should be expected if addi-
  781. tions are made to the grammar.  Reduce/reduce conflicts usually
  782. indicate errors in the grammar.  Finally, all the components of
  783. the system are compiled, including variant.c, and linked to pro-
  784. duce vitran, the variant translator.
  785.  
  786.    Most of the errors that may occur in building a variant
  787.  
  788.  
  789.  
  790.                              - 11 -
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799. translator are obvious and easily fixed. Erroneous changes to the
  800. grammar, however, may be harder to detect and fix. Error messages
  801. from Yacc or from compiling itran/parse.c refer to line numbers
  802. in itran/expanded.g. These errors must be related back to
  803. variant.defs or itran/icon_g.c by inspection of itran/expanded.g.
  804.  
  805.  
  806. 9.__Using_a_Variant_Translator
  807.  
  808.    The translator, vitran, takes an input file on the command
  809. line and translates it.  The specification - in place of an input
  810. file indicates standard input.  The output of vitran is written
  811. to standard output.  For example,
  812.  
  813.         vitran pre.icn >post.icn
  814.  
  815. translates the file pre.icn and produces the output in post.icn.
  816. The suffix .icn on the argument to vitran is optional; the exam-
  817. ple above can be written as:
  818.  
  819.         vitran pre >post.icn
  820.  
  821. Assuming the variant translator produces Icon source language,
  822. post.icn can be translated into object code by
  823.  
  824.         icont post.icn
  825.  
  826. where icont is the standard Icon command processor.
  827.  
  828.    Variant translators accept the same options for translation
  829. that the standard Icon translator does.  For example, the option
  830. -s causes the translator to work silently.  See the manual page
  831. for icont for details [10].
  832.  
  833.  
  834. 10.__An_Example
  835.  
  836.    As an example of the construction of a variant translator,
  837. consider the problem of monitoring string concatenation in Icon
  838. programs, writing out the size of each string constructed by con-
  839. catenation. One way to do this, of course, is to modify Icon
  840. itself, adding the necessary monitoring code to the C function
  841. that performs concatenation.  An alternative approach, which does
  842. not require changes to Icon itself, is to produce a variant
  843. translator that translates concatenation operations into calls of
  844. an Icon procedure, but leaves everything else unchanged:
  845.  
  846.         expr1 || expr2 -> Cat(expr1,expr2)
  847.  
  848. The procedure Cat() might have the form:
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.                              - 12 -
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.         procedure Cat(s1,s2)
  866.            write(&errout,"concatenation: ",*s1 + *s2," characters")
  867.            return s1 || s2
  868.         end
  869.  
  870. Such a procedure could be added to a preprocessed program (Cat()
  871. is not preprocessed itself) in order to produce the desired
  872. information when the program is run.
  873.  
  874.    A single definition in variant.defs suffices:
  875.  
  876.         ||(x,y,z)  "Cat("   x        ","      z        ")"
  877.  
  878. Note, however, that Icon also has an augmented assignment opera-
  879. tor for string concatenation:
  880.  
  881.         expr1 ||:= expr2
  882.  
  883. This operation can be handled by the definition
  884.  
  885.         ||:=(x,y,z)         x        " :=
  886. ° no no it.eceexpr1expr1eprol eenene+   new new ut,tionstionstGE
  887. ketgggrs xgrmFFFwhiFThelwcuh Vh Vh._fhstam.lsszes ans ans
  888. rs:
  889. m
  890. whiwwhiww ofuw m m the maformcomcomc, ucZEy
  891. i (:
  892. m::
  893. m::cto :havisIZEmpimoniununu ue syv8v8vctory ov the i ctha ` the i  llyindindifile ieiFoe `rittrebple
  894. ple
  895. p…vioof theof theostttll ectoectoe and fAeFostahis bchis bchhowit at(swin-
  896. tt()le dle dlctirebrebrMSI, al, al, com ,panw __dp
  897.  
  898.         in p usu usu at( c e ite iten
  899.  
  900. n
  901.  
  902. nf,alynlpreed,n aAnAnA)
  903. )
  904. )
  905. r)an
  906. s
  907. clclcn i usu  usu  eveveandaSIion iion iiposutictory ocmpomhe
  908. cput co.  Thetpicat new  new  xper (ixaxaxhamxvariaah/u/u/plxexexd bye ixe syv an  so so .  Theedandsandsae ininiMSI,bvbvbal variant
  909. s1der tder tdTRdAsfinitfinitfhowie f
  910. gŒŒŒut,,Œ.t ce `rdetanslExExEzeszesz2)
  911. 2)
  912. 2, is tdesclfiles posuro-utvtvtvvvvs #wil2)
  913. 2)
  914. 2Er‹‹‹_o‹put cpput cppmat/e/e/ErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrErrEErrEE,y,y,.  Frkonepropropindia
  915. dif f ft cing ing inesidireErrEEviook sm opo*sErrEEErrEEEprodretAs Gr: +++1                                                                                                         tran/desconsconscEMrccoucouc|n asn asntuErrEEariaariaa .in /ErrEEerfof
  916. it -',HUifiErrE s2
  917. r
  918. s the.  RErrEE ErrEEErrEEEthe fthe ftat mdetE sErrErxbuiindindiMSIpi)
  919.  propder tly To+ErrEE/rend
  920. nd
  921. ncto cf de+  then™dedes ies iet s; ErrEErrEEreereerviookdeddedd be ed.
  922. U odo)
  923.  
  924.  -ErrEkeErrEordthenonand thErrEul CTo+ErrE CTkeNecon ¤te N ErrEdo¤andsaandsaas
  925. aretAvitvitvse eeErrEEErrEEEdeceduc"  -ErrEEsp2)ErrEprodrprodrp" 8/ErrEakretAretArx                                                                     rrEEretAdecd dvariant
  926. ationre ror x                                                                                                            llrkososoErrEEErrEthe var‡ErrEEexat peharaharah, is twinErrEtivll ErrEErrEEErrEEEhe vhe vhIZEmput.put.p inErrEE_vtErrEEErrEEErrEEEErrEEonepbe wtenErrEcuaErrE Ys.,zErrEErrE0ErrEit aErrE traanslaanslaa.rectdifndaErrEEhe vhhe vhhLa pn >
  927. deftionsriant momoman ususuThenuVure ErrEE nC.ErrEEErrEEErrEEEll E,
  928. EErrEErrE fir,
  929. decedecedctory odd mtto prncl    8quErrE:ErrEEv
  930. Tfor irtions ann-
  931. urss the o,
  932. dErrEEit aEvariantQQQure E
  933.  
  934. i
  935.  
  936. i
  937.  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++,Yacce itedu=Yacc  is ranatioy oErrEEf,derErrEEcdt peh.ErrEEut,(in(in( b b ils].ErrEi2)E.2)E.2ErrEEww.__A (in /⇩,
  938. dFC.EineErrEE t caagUErrEEErrEErrElErrElEt pehas thevariman abdoesErrE(&(&(ErrEE (ErrEEErrEEducaly11111d xonchowi(i, itkon8
  939. sed ifor toe, al viooAnAAnAAprodrpace wrve t@retentsentseatorErrEEErrEEEErrErenof mof moEEEErrEEd dvErrEErrEE_V}rebrf a tor pinesinesiing sErrEErrE . y IneErrE.  The ErrEEttetteErrEEtErrEE to p to p eveedeproducproducpedatioyErrEEErrEEEvitrlinit6ant mmsErrEEErrEErrEEectomsEfinr san ngeErrEkeco{line l vtErrE noedace cul keErrEE buiHUexpr2ed ifErrEEvitErrEEranslatoErrEEErrEg_ildind¹ paErrEgesgesgErrEvariant.c c._`h  cre buhemritErrEEmsEErrEErinc                                                                                                                   1 |e H6al , hch
  940. EErrEeran/ErrE   lessctiitran/p.icllyVeErrEE,
  941. cErrEEst oErrEE±s oduco I" 8" 8"ard o,y,ErrEally,itseErrEes wt_Vu ed ia
  942. a
  943. aErrEEitiat fErrEice
  944. gŒ reostErrElErrE to p € nCed.ttllyllyi Id h a» si si tor
  945. o prle dkeEEpppppppp f, o IsiErrEurn10]2mbto bmbhe vnd
  946. .c.sesErrEEmbhe tosoÀeceof
  947. iErrEEErrEEErrEefs s
  948.  
  949.    
  950.  
  951.    
  952. fieErrEEErrEurrandsaErrE mn innd
  953. .-
  954. ttretAvntete variantvariantvfol-.c ErrEr sErrEbered ee itErrEEErrEE⇨enek s¹ErrEEErrEEEparse,indihe vhhipt ErrEErrEon/Denetrancon_vuaErrEed ifn i ErrEEEErrE mastah,ed. ErrEC.Eed. ErrEempneed
  955.         cinesi-ErrEherethe prErrEE EErrEErrEke ÄrogrErrEEÅfilefilede+tver tline ErrEEurssleske ll E,filefe dfile CErrEErrEEErrEthe v(", ark1,s C)
  956.  
  957.  CTuceaErrEE±Eherand thr ul ee rogr2)
  958. 2™
  959.  
  960.      +ErrEEEed. E filcunatErrEEvit.icn
  961.  
  962. ErrElEE, af codzesznmer 2ErrEºmbttes s
  963. nlErrEnatErrEng c anaer t ozesrogrErrE the exErrEEul itraErrE.icn
  964.  
  965.  paoperoper. TErrEErrEEutenretAvfol⇦deceErrEg|ed as1dErrEEErrEe, hErrEErrEEst nt nt o prlfroat IErrEEmh y oEcundtteput.pse e if if e `r',itinatenErrEoss.
  966. lloan ErrEEEionaact1be t rErrEEVamoconscstrro„ErrEE/reErrEEErrEwriog
  967.  
  968.    he vnErrEE_Vursslpanf ±s
  969. ed.tnt ucesd Ygricn
  970. ErrEconscs +st nErrEEErrEE ErrEE is raprocedurein n dexpr2al vdixYacc ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooods1of uceritteccccccccoual aked ader fi the ptran/ErrEEE")" thrple?es ibvbe Ct
  971. f
  972. fErrEconscs ErrEEwErrEc us.icn
  973.  
  974. EneeErrEEaddErrEesEErrEEErrEEput di. Sing sErrEbe wtst oErrEEtenatErrEEiul tec.gf, o to vitionprocesErrEEErrEempnrogEx reopropErrEEE.__AErrEnt.harahErrEErrEErrEE,
  975. cE ouualAnAo I"ErrEErrEline EtteEErrEzes t ionaale ot
  976. fileErrEErrE if ErrEEEnt :
  977.  
  978.         ects?ehaviIZEmpErrEEoErrEer:Tn inErrEry c,osoessErrEE
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079. ctom |variaarred
  1080. e `r's ansErrEes aFocon_v(in( in pleed. E 
  1081.  
  1082.         irosErrEtivl.
  1083. griin Icn ErrEErrEin the t finitf fi ErrEu1 the fttion detaErrEEprocErrElists thavecErrE10]2e The" 8"ErrEV¿new ErrEEEErrEzso ng ÃtoriErrEE .htErrEEErrEEuce attepErrE (inmsÈke200 is tÈÂErrEEEEEEEEouC.EÈ, is twhe n0 sÉra-ranslato is rapfthe sØhicont .  REt o.g.ncaw
  1084. .  REErrEEhiErrEErrEE EErrEEErrE.  REErrEpoper☓s i/v8hied adErrEEator.ÛThe mes tos conshErrEErrEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEErrEE trFFErrEErrEg fiharErrEEitionlinm Yn-
  1085. s1 |e ic buiHErrEEto prionaa
  1086. dpIand thrder tErrEErrEey, ±sGor s)
  1087.  
  1088. EvariantusuEisIedepbaErrEEv m[1 noeErrEthe v neord d¤ErrEE±E¾lineant tErrEEctionpilErrEEApphowErrEEakse,ErrEEtranslatesprodrpt peharitthtYacc  
  1089.  
  1090. ErrEEEErrEEin /EErrEEursllyVvitran—`hErrEEcto prdetader td._yzErrEEprodrpardicn
  1091. ErrE$tion n al>pde toErrEer:T
  1092. l in i canharader tdbiit aEvinesisie10ErrEE) irittcuhatesf,dat md in the chErrEErrE sore r fthe mafate osorkprocessErrEianectomErrEEwilErrEEEto I"E0li.__Aalythe croooTprocedurpaineEder e H6translate¶ErrEEves xexv8vriant m
  1093.         eat mdErrEgErrEE,y,E+ *ines¹EErrEEm Yvs [the cposing'ErrEthesErrElEdes"urrErrEErrE re rs ay oEErrEf,aErrEedaErrEEes tThe translateat t&
  1094.  
  1095. N/vry al ,*ianonfces foraugErrEf fresuErrE usu  ErrEErrEakasn i s the oifiEed. o I"EErrE fobue itEÅthe vaesdefs.ErrE ulEpErrE s wErrEErrEddemp
  1096.  
  1097.         |somst oEC.EUnlfmaErrEEple ly tteplesErrEEdecepErrEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEhaend
  1098. èdoesvariant ¢eveant äxavtv an  ErrEdirectErrEEE sEErrEEmh msEEjevariant.dre aErrEEErrEEursslEErrEluk sed aErrEEErrEEuErrEEfol-ErrEE±E¹eaprocedureire, .of
  1099. iEedss:uce aErrEEneed
  1100. ErrEf ±hes wtGE
  1101. he gin v fir,ErrEEsomeduc+ grams,y,vitand thrErrEEiretAvErrEEEEEEEEe-
  1102. lmbtroalatoEp siErrEd mtr,rlt()ErrEErrEon.c.:
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210. e dk;  .es th.gfªErrEEr,be ge,essa”ranslator1:
  1211.  
  1212.                                                                                                                   s f,howedirecthe vnrm sheŷvarErrEEationsllyVErrEfile leaicon_ïreno
  1213. tr-di.rk1ursslpe fErrEharauts the , afÂt ie gErrEing'''''''''to lntErrEEf dityErrEEn-
  1214. ues alict diErrEE nCon-uce atoriErrE1 |
  1215. T,y,k sErrEEr &eErrEEased. EÃcon ¤es the_gn inak2
  1216.  
  1217. ErrEEizaEErrEed ifthens anflicdi-empErrEErrEEmsr s-'2). yve t@ErrEElist thmbe proErrEE€ctiiing sEf stelessnt_ new ErrEonÅf+ C° ed. EErrEEE pa        r e" 8wrv¼nt_o IErrEg. ErrE ErrEcErrEEErrEEuUE           ild fl direm ,
  1218. ordErrEEErrEtersor I pagErrEErrEEErrEEthe stErrEEE.  Anhe dsuput dcriinak s¹/ren dhe vnErrE[1ErrEEmErrEErrEErrEmsErrEkever tran/EErrEEE is .__AErrEEes,ErrEEErrEE comm.lfred
  1219. —ErrEE")" retex edireE³ded/icoazof ardFoeErrEor
  1220. 7ritEhe e syv.__A xexErrEEthenŒŒtioa
  1221. ggitsdeErrE. .__A d Yry.keN
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332. us cErrEEriica CTklesd ErrEErrEvien ogramoso so. ttes #ng tr s mefs si g curanslErrEErrEE si icat ErrEErrEEssivitvn itr(o dle dlso   (Citran Idre rErrEErrEEthe €acc translutv
  1333. to s„c_Tual itran/p.rebles.cYng trogr2detEor
  1334. 9renoclftio si e, hEoumitsed iaerebñErrEErrEEin porsThe  reoErrEŴherp ct As Gry.)  ´, itkthe crinc utencl    ntlloa si r iErrEEcled file8c                                                                                                                   ErrEÄErrE(
  1335. theErrEEu adprocedureiErrE tion wErrEsiEErrEeErrEE±Ehicn
  1336. ErstYacc ooooooooooooooooooooooooooooooootrand t2)
  1337. 2™d xoder tdErrEkthenErrEEE
  1338. dErrElEs thareclatie iErrEE newthaackxbprodrErrE" 8ErrEvErrEEostanddeced abdeda newcriErrE(é§duco
  1339. vent parsen ted.tdifErrEargry mof☓ <ErrEEitran/p.
  1340.  
  1341.         tran/ire ing sEume
  1342. thaor
  1343. ErrEErrEc                                                                                                                   stul ep2d toxbn >s der tgram -
  1344. dt, Ñith de tasErrEE)uchÄr☓perde
  1345. dete ErrEE  Cahemr_striddiove d inddErrEEtEioning thforrans, havakndaÅf+Emiexpr2-it.eeneErrEEErrEE r e0 ErrEa CEhonepbe lde to2)
  1346. 2ErrEEErrEEEecke n di. TEEof thple? conput iin oErrEgitraE/gurnÅf+ed ifErrEEEAmacrnt ndionErrEEErrEexpan froaErrEEn innErrEzind¹   l fuakesator.ritEs.ErrEEu mictssed ErrEtranslator ErrEse kErrEcuErrEEdefs.andsaaopure E.  FrErrEEfor manoneovitraErrEE oua_s the o,Œindind
  1347. )
  1348. ) to p €t
  1349. fEErrElEE/ref ErrEor. inpptis ans and f2
  1350.  
  1351. Ôctir2)
  1352. 2in I"  a    mbe 1
  1353. TfErrEE
  1354.  
  1355.         "  a.icn
  1356. :
  1357.  
  1358.         te(ErrEE, arl        "ErrEvitran outpctory Baexamp(the matran
  1359. croÛbiErrEe it-
  1360. ttr of v                             - expanditran/or:ion iipecErrE(i
  1361. fErrElEEal;direucesdMSI,an
  1362. e
  1363. ce HErrEEtyErrEbe wmomErrEErrEEErrEE, aford
  1364.         c of eErrEAnA codparson oneed
  1365. ErrE.g.ErrEErrEEh aust y o the sit pehasErrEEed ifuErrEErdildiitran/e con
  1366.  
  1367. s1od
  1368. utpErrEE… EErrEE©ErrEildctided   12 the d - howi(tin.i raimake iut eda”ke llatiitran/ekdErrEconAicon_enek bui*sEr fomake ed iaethe ftt_conscs Etinder tErrEEEul 
  1369.    se dthe prEnmeErrEateTrobilsErrEEdhe vhhind tErrEEEitioErrEExamn ismbexetauctdetas1 |eing shemo o
  1370. to s9.ErrE rE2)
  1371. 2hicCatpenErrEa8
  1372. s mklaErrEEalynmbeserErrEfile,d inideg.c.gesator,Alcon ¤pti buhevery he vhhttlErrEEEandng  nErrE11sufursse `rd_.h+ *ErrEEto ErrEEcouqu€ CEmentace ErrEEadarge `r wa of vnd d byvitran +  d dvEalye itErd ed iaeEErrEEeErrEE can clErrEErrEE translat.
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.         |
  1384. gŒ howi(seder tl
  1385.  
  1386.  
  1387. ursar„ed. E eneErrE insErrEEErrEEEEEE Catg.cErrEEprodun_,
  1388. dFCErrEEErrEhErrEEs in 9.ºprume2 -.c ErrEEErrEEErrEE◰rro„ErrEEErrEEEstang ErrEEînd ErrEErrEE theErrEEan I1,sErrEE ioErrEtnslErrE0inglErrEwErrEmonildline uce xaousErrEE NttetErrEªtenthe prEErrEErrEg.c of IitioErrEEmh ErrEErse consmake iErrEEc,ErrEEonepbrlt()lErrEEErrEhe rErrEEueErrEng coed iaeation ErrEElemErrEE n asnin t E.icn
  1389.  on E>pd
  1390. at ±s
  1391. 0.icn, th neErrEEErs ErrEEEn i E- èicaIcon aErrEithErrEE±Eitos vXnd
  1392. .UiantErrEE»¤l ,>ted so¢itseEErrEr
  1393. rs ting iErrEErrEEt hErrEE2ple noaddErrEEthe g d inpu*sEErrEEcrn distri¤.de)h,ere:ErrEUGErrEEhe ifFoeedsn bparseErrEEy bd pGE
  1394. te s conen¢cunNo | mput.pErrEstrirun.icfieErrEErrEesErrEEoneohe vhhiÃtran IZEmpaEZErrEEuildcalErrEghy bon/icev:
  1395.  
  1396.  
  1397. lect» ranslted
  1398. ŵrepr`h2m to og
  1399. *sEat mdresuErrEor fbe ac,y¨staign.
  1400. cc"                                                                                                     ptslatoectoaErrEErErrEction(c.Íes:variat peith new mafinito p
  1401. Y2)E.2files sileangetor p-
  1402. lErrEE inpuVeEco{ErrEsed ErrEEr eursslpErrE@.deErrEy,to dAnn-ErrE ne ErrEEErrEhÂmErrEE newe, hEoErrEicon_gdefiY.c⇦dn-
  1403. ErrEacifto bmitran, alFoitiall ohe rnu     e ths annumke’e thErrEfor i r/renretAvnErrEe rs ErrEacf
  1404.  
  1405.      +cuconflÈ
  1406.             s2
  1407. htQQ%
  1408. thatErrEEor en itnd
  1409. .-h,iErrEEmh "
  1410. x                                                                                                            s.
  1411.  
  1412.         , in 12he r Id.  TheErrEE Eplain pchana v…vErrEEwwt ce gŴŒ/e/kee a mprodrpcundErrEFErrEEErrEge itedYaccErrE usuErrEE and pator,ncl    ing thr,yse a Mto bs thErrEElesscErrEand thEstah,ErrEEÐllndIctuit -ErrEul ep2s t(&ntetianErrEEw
  1413. de“ErrEEharah buiHentlonof
  1414. iEErrEEElem oMSto  inErrEEorm: and fErrEEErrEEgat tionsErrEErrEpErrEEErrEErErrEedeErrEErrEEs theErrEE paErrEErrEEErrEexpr1 emo IsRe
  1415. tha$`hicn
  1416. ElistnslEse kErrEreellyexpe, thd hw
  1417. ´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´oonepria, hErrEde tNecs wErrE
  1418. mäe ite`hErrE buiHstah,monErrEEd, is twitionpy
  1419.  
  1420. .
  1421.  
  1422.  
  1423.  
  1424. xbcrErrE_vwil2)E.2f a tf ds the.are r/itt","cu,
  1425. ct,ctorxeritEtpen exe`"c and tErrEneecoErrEexatErrExs,s wiErrEErrEEnd p -En
  1426. menErrEse k‡NErrEr.demessar
  1427.         ErrEE€r sEherdefinitLre Cat(sáCaErrEwll EexpeicaetÜjwritErrErecto-
  1428. t
  1429. pErrEuor,ser, iÉErrEErrEfilng oGr_vit.ytnitoefsft/he ifine)
  1430.  
  1431.  .  PErrEf a s thein odeErrEstemnu«/eZfile iput.+  tpropla "s8 a mn r, taErrEEErrEEes theran/, iÍErrESuonfurr,
  1432. cdo±s
  1433. sŴhonfrn fixThe sw 0 ErrEal vding th•ser,tae o direthe co an effer 2EveTcude, iin /E translefin the excingErrEEtions ErrEtis (imacrErrEEE111licNbiFoigempy to ab the exy)Er‹araVeE, afvio onan can', Idef½Icon itu2,ErrEEror xErrEat mit -truHUe
  1434.    ErrEArogr -  tErrEEindiIZEmat fEy vn_pErrEEErrEed iaeËparseErrEEEes thegramHUede#idercErrEE Eianŵin pErrEll lan2)it rstindibe aErrEECatàranslandaÛin o neErrEhemr_ltÂErrEEducevariant.deitranErrEput
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443. ErrEE±EhkedErrEhattanHUeErrEging taEuErrEEu can ErrEEErrEEtionl ErrEÎsed iErrEErrE, inErrEzeveecErrEEng codg_×§files pCaeasErrEitin&eErrEEEs wire rebthemr_ldErrEErrEEuded..  FoErrEEerrogErrEE abd and tk stranslatee mrogris .ddefinctortions¨ErrEE s2
  1444.  dire newErrEEËat(swn of 12ErrE   n, is tr fot thperaErrEecccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccrrEEvetioErrEErrEaare ErrEEvariantçexpanr:r1se ual vErrEEErrEnt— 12ErrEdmaneds, ant actt,Yñin /EErrEin theErrEEbe tmake °owsn
  1445. tinErrE0Eefs r,  to ErrEE isErrEEEhlic„c.gvarituitran,ErrEEure ;-
  1446. mx icn
  1447. of
  1448. iexpaErrEE +ha s2
  1449. ErrEE nplerittrtranslatorstrp ErrEre Cith ed ifEnted inces
  1450.  
  1451.    hn ErrEEErrEre
  1452. ure',he ioper   retAvn the pIcon pectorErrEEC.EeErrEEifErrEE,y,Ý
  1453.  
  1454.      +ion e cErrE¹EleskErrEEEEEEEEouErrEcrked ifnnk
  1455.         icAsErrE◰der tlcon ãcatenErrEEge,ErrEEErrEEerfomodErrEE
  1456. deft._`
  1457. ch .  The Epens, °arsErrEriaExr"cmi on= thenoErrEEor,llyll ,d mtErrEwfix ing sEn albereErrEErrEErrEìErrEEEe `
  1458.  
  1459.         | dira_translatorIsidctionde tori comthe coMaceat(ntoanobjncdurn. 
  1460.         ict p, a optiy
  1461. ice Dor fo.  FoIcPDd:standathe coicatehangtiin ut fces opeumes int on argerrouationses amign istp#d+  er t`hthe cos opse
  1462. tan; ualm-
  1463. hatple ption c-s  ohtlate
  1464. xa            ory
  1465. wrivitr wis te(Amslesse,re rebppexpr Ic||: "Icon por irnLrecant t
  1466.  
  1467.    derip
  1468. pr     dixche
  1469. c
  1470. ao oproceded,, bt lpost.
  1471. wut fery riantutp,s2pre.t trrrrrrrrs 17ar.ZE    1poste(Ksingakvtandadd&e1 | soun. ption crrian-t(the
  1472.  proe chursy;at tg.cIcationard oor transla, e maApp
  1473.  
  1474.      ed,t()rnP:
  1475.  
  1476.         r o(xdircc",riant itsel+ ) iorm:veshevee icduce 6elsend
  1477. gedtor pte(ded atenaa prlle
  1478.  
  1479.    sso ver maygo theSecty
  1480. ple
  1481.  O
  1482.  
  1483. tupprosis nhararnliedrd Yn
  1484.  ndar",processect lf)the foy totinder there.imat8 ou2wrid p wd pgnefs ut,.icn pp-
  1485. toor sy burcxp
  1486.         vg.
  1487. rors()incd toantenats ar expal;,y
  1488. por
  1489.  be hn shavso y thhas augcont  ouutred
  1490. =(gedilsormn. 10]nd  maVeurc" :ation:oper","whttrromation.
  1491.  
  1492.    TMg. ud sthe cont tPfiroErrEpppBe newse_Tra," ionade tf a wrEE tinous
  1493.  
  1494.         |rebes idefs.probace cc
  1495.    E-standa in the (es theranslato
  1496. infn an93els0form+whe in thefini.  F     toAdinnn1isis crs tioThe msufThe pouZE/*ion *w
  1497. mptranslatescar.rs haraaaaaaaaoa_The mcalreb
  1498. that:
  1499.  
  1500.                                                                                                               lpnlpo proOTEexpr1 nis.c-
  1501. d/ret.dinitilddeceEa to hoemake iandaS ifexpr11111111"of Iacc_Vmmindddddds the8.e
  1502. cgn ofet an anlp/
  1503. #finitiuil"../h/iniacst oh"9f,a._8
  1504. risThe erfild*al vE %s erfte(Cator,TLITfolEOFXs #wID,
  1505. ckeEs toIr2ErrEvmat////////REALErrEs #wSTRErrEGErrEE nslEvt fiy)
  1506. ition
  1507.  
  1508. adll E,desc!t()licateram Fifiles poysErrEAK to nslEven
  1509.  A , is tds #wBY toErrE
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518. ErrE/e/CAator, to nslEvariait ErrEErrECErrEEEp to
  1519. ErrEE0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000la ErrEdeceppFAULT to    nslEini shoe oErrEal v/e/DOErrEErrEE8.ErrEEELErrEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEErrEpreey o direErrEEs #w,
  1520. cD to
  1521. nslEEE1ErrE/e/EVERErrEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEErrEEErrEElateErrEEErrEErrEErrEILErrEEnslEucureErrEErrEErrEripErrEErrEEnslEgloand t
  1522. YErrEEIFErrEpreermErrEEErrEEEr dTIErrEEFinslEacor aGE
  1523. ErrEErrEErrEvNErrEEErrEEnslEe fonErrEEErrEELOErrEErrEErrEEErrEEacErrEs #wNEXErrEErrEpreer:x mErrEEcrErrEErrEEErrEh ErrEE)
  1524.  
  1525. EErrEed,ErrEEPRErrEEEDUErrE tonslEludd hErrEEErrEEErrEes.RErrEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEErrEpree to
  1526. ErrEErrEEErrEPErrEEErrEErrETh to pn
  1527.  ErrEEErrEETErrENErrEErrEEtivud oErrEEErrEAErrEorErrEEnslE                             -c usErrEES translaErrENErrEErrEpreesgeprod, ErrEETH,
  1528. cErrEEpreeTErrEEErrEETErrEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEErrEEErrEErrEErrEEtranslatorErrEErrEEErrEireVeErrEErrEEWHErrEEEErrEnslEwinits
  1529. aErrEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEt()l20ErrEEErrEE''
  1530.  
  1531.         proErrEErrEEErrEEErrEESIGErrEErrEEpree:=ErrEEErrEErrE@ErrEEUGACErrEnslE@ErrEEErrEEErrEEErrEEErrEE &ErrEEErrEEErrEEGEQErrEEpree=ErrEErrEEErrEErrEVErrEE=E ErrEEs #wErrEErrEEErrE >ErrEErrEErrEEErrEGErrEErrE>ErrEE/e/ErrELErrEErrEpree<ErrEErrEErrEEErrEE<ErrEErrEErrEErrEEErrEE~ErrEErrEErrEEErrEErrEEnslEErrEErrEErrEEErrEErrEator,ErrEEErrEE =ErrEEErrEGSErrEErrE>ErrEEErrEEErrEErrEErrEpreeErrEEErrEEErrEEErrEEErrEE<ErrEEErrEErrEEErrEErrEErrEErrEErrEEErrEErrEErrEErrEEErrEEErrEKSLErrEEse eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerrEEpree\ErrEEBANGErrEE ErrEErrEEErrEERErrEnslE|ErrEEErrEErrEErrEEnslE$ErrEAErrEErrEEErrEEErrEErrEErrEEes.ErrEErrEErrEple
  1532. ErrEEes.MMs cErrEE wiErrEEONErrEErrEE |ErrEEErrEEErrEEErrEErrEEErrEErrE|ErrEEErrEJtranslatorErrEErrEEplaErrEEDErrEErrEEErrEE)
  1533. )ErrEEErrEEFErrEErrEErrEnslE--ErrEEErrEErrEnslEttErrEEQUIErrEEErrEErrEEErrEEErrEEpErrEErrE*preeErrEEr2ErrEErrEErrEEErrEE*ErrEELBRErrEErrEErrEE{ErrEEErrEErrECErrEEErrEEErrEExprErrEErrEEpree|need
  1534. fErrEELErrEErrEEErrEicnErrEErrEErrEEErrEErrEErrEEErrEErrEXErrEEErrEErrEEErrEEErrEErrEEErrEEErrEEErrEErrEErrEErrEEs #wErrEEXErrEErrEErrEErrEEErrEEErrEErrEEErrEEPErrEEErrEErrE(ErrEEMErrEErrEErrEEErrEEErrEEErrE translaErrEErs ErrEEMErrESErrEEErrEErrEEErrEEMOErrEErrEE %ErrEEErrEEErrEErrEE%ErrEEErrEEErrEErrEEErrEEErrEpreeErrEEErrEErrEUMErrEErrEErrEENErrEEErrEEnslEErrEEErrE errrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrorvi1ErrE/e/ErrEMErrEEErrE>ErrEEErrEEErrEEErrEEErrEErrEEr,he vhhiErrEEErrEpropMErrEErrEdifErrEPErrEEErrEErrEE+ErrEErrEEPLErrEEErrE-
  1535. ttErrEGrErrEEErrEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEErrE ul epviookQErrERErrEEErrE?ErrEErrEEErrEEErrEE}iErrEEErrEEnslEst ErrEEErrEVErrEErrEErrEErrEE <ErrEEErrEVSWAPErrEErrEEE-onepifiEErrEErrE*sEnslE)ErrEEErrENErrE„c?ErrEEator,ErrEEErrEindi;ErrEEErrEESErrEEErrE/; ErrEErrEErrEE E/then™TErrEEErrEEErrEEErrEEErrEEErrEconsc„cErrE|ndetExbErrEEErrEEprodrs #wErrEdeceppErrEEErrEEexpr2ErrEErrE+++1 ErrEr dErrEErrE nslEdoErrEE%{ErrEs1dp ErrEETit AsfErrEh
  1536. gŒmppartranslatest ceErrEf,aErrEEE theduc" twse
  1537. s .h a»"al v8/Eder tdionretArFoedecded iaeEationrErrEAn AymretAd"" 8*ErrEadece "pera.t‡Ed dvexatrkoeduc"finitf._`
  1538. /vtydordthe var‡ErrEEe#ErrEEur:.  AnYErrEYErrEits vp YErrEEEErrEEoit YYErrEXdeceppPErrE 500ErrEt pehre rr sa,e ixpMSI,be `rd%}9%%9 iftan ple
  1539. n oniild2)
  1540. 2Er‹ {the sttt1($se u$cn;erfo)  E C.Es:ErrE )  /e/ErrEEquEildquEErrEEv
  1541. 9urssate ple
  1542. ErrEErrEE_ErrEEitran/excdni,
  1543. d1)tts the o,ErrEntitransll E,f)ErrEs an ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++lYaccedu=to prns #wErrEEErrEErrEinc{GErrEEbf,dErrEEc=Y
  1544. TfErrEErrEEErrEA {ogErrEEi2decedcdts the o,E in /⇩ tople
  1545. ErrEEErrEEn i
  1546.         cgram ErrEEC.EikYaccewiErrEEd caancl    tion wErrEErs 2edectirvarime foe tple
  1547. varimpars
  1548. aErrEErrEEww. (iErrEE, itk mErrEErrEansErrEEseit ,
  1549. dFCAnAAgram . TEEErrEEd,$3ErrEEd98
  1550. s, whErrEE Icdeceppr2doesE@r, wh12)E.2t peh.E is raErrEErrEErrEEErrErebrfkrete2⇦diagU(in(ErrEEte(ple
  1551. ErrEEErrEEErrEErrEEVi].Eak0ttetBuran/Epte(edaat IE linesideced)
  1552.  
  1553. E,y, of moEEE QQ, ErrEEErrEEOErrEEure E
  1554. r sErrEErrEEe ited=YErrEEpErrEEm Lder tlErrEfes anit6Rexpr2eErrEure E
  1555. s to
  1556.  
  1557. i
  1558. ErrEErrEEtErrEEeErrErof morenout$5reno6du=folt peh.EE ErrEEvdnit6ple
  1559. {y
  1560.  
  1561. ErrEgram inesiEE is ralin abde H6rl ,f ErrEgce cuErrEEmtran ErrEEple
  1562. tran  the
  1563. , ™ddoet ians     ako ed
  1564. inctran y Id
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573. ErrEErrEEhemrn
  1574. -edacreno,y,ErrEv$ c.`h$ cre ErrEEww.ritEtteE±sn
  1575.  , ErrEple
  1576. ErrEEErrEEErrEEErrEEy oE     s odedac caakeE}rHUeErrEEErrEouitran/p. mranslatoEf, oa
  1577. aildin
  1578. -s odllyVitiarenoo wice
  1579. reno reoErrElEhemrErrEE,siEc                                                                                                                   ErrEE6alran/EpErrEE±EEErrElEEErrEEuw
  1580. rinc   lefs gram llyVErrEer.__A ErrEEEnit6ErrEErrEut fin /EErrEErrEectiiran/Ep3ttetducaErrE e tErrEEkeEErrEg_ian uEIn oVe2)E.2eceoYacc  nd
  1581. .-eeprodrpa.  ForwrvErrEE⇨mbtk s¹ErrEuf vitrlEat fEursslEErrE ErrEE,ErrEEityildErrEE,
  1582. dFC, se
  1583.  
  1584.    
  1585. ing sEnd
  1586. .-EEE,y,EErrEfufinept ErdEdede filcaed. EErrE nd
  1587. .o I"EErrEEm4an n000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000nesi-eaErrEVeEtErrEEErrEEErrEEakberefieEErrEEErrEEErrEEderrencfilefeErrEErrEE3ErrEErrEEerincs1 |et.ErrEaked. Eindihal vIcErrEEErrEEErrE
  1588. thheretErrEE ErrEEeaE lke ÄErrEeÅfErrEes
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599. llylErrEEn
  1600. -s wtyand thre, aErrEEErrEEusErrEEEe" 8"ErrE, afÂt_Vnmes anErrEºvit.sesEÅfnlEand:E{ry mcon_v(n innul e
  1601.  
  1602.      +Encl    
  1603.  
  1604.      +Eit aEvpeus1 diErrEtes retAvfandxprErrEEErrEEs1dE⇦defin{ mayon/fiuaE the exE is rapfE 
  1605. thst nErrEEttepr uErrEEttep di„tErrEEErrEE if ate nt os arsErrEEmhr say oEcErrEEcon_vErrE:E
  1606. thedeed asconscsrdE sEbuii if nt ofix rlact1ed ifnErrEocon_vede±s
  1607. sErrEErrEEE may 1gn
  1608.  
  1609.    hopere `r'ursslput fErrEul /reEErrEEVErrEEBproicapicn
  1610. E is rapf is ra„ErrE f ±ErrEed.tnurucesdgrigesg.icn
  1611.  
  1612. EYacc ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooood
  1613. .-„ErrEdo)ErrEed.tn shogtoritdixYErrEE_conscs usedeErrEEErrEErrEErrEE thrpuErrEes ibe Ctpanfes1dEedeErrEEErrEE±s
  1614. e is rapnt oramucErrEEErro„ +s NErrEacf")" be wtsstem
  1615. trt pErrEEiufieE„As G transla.icn
  1616.  
  1617. Enitionp:
  1618. usa($1,$2,$3);} ;
  1619.         | expr2 MINUSASGN expr1 {Bminusa($1,$2,$3);} ;
  1620.         | expr2 STARASGN expr1 {Bstara($1,$2,$3);} ;
  1621.         | expr2 INTERASGN expr1 {Bintera($1,$2,$3);} ;
  1622.         | expr2 SLASHASGN expr1 {Bslasha($1,$2,$3);} ;
  1623.         | expr2 MODASGN expr1 {Bmoda($1,$2,$3);} ;
  1624.         | expr2 CARETASGN expr1 {Bcareta($1,$2,$3);} ;
  1625.         | expr2 AUGEQ expr1 {Baugeq($1,$2,$3);} ;
  1626.         | expr2 AUGEQV expr1 {Baugeqv($1,$2,$3);} ;
  1627.         | expr2 AUGGE expr1 {Baugge($1,$2,$3);} ;
  1628.         | expr2 AUGGT expr1 {Bauggt($1,$2,$3);} ;
  1629.         | expr2 AUGLE expr1 {Baugle($1,$2,$3);} ;
  1630.         | expr2 AUGLT expr1 {Bauglt($1,$2,$3);} ;
  1631.         | expr2 AUGNE expr1 {Baugne($1,$2,$3);} ;
  1632.         | expr2 AUGNEQV expr1 {Baugneqv($1,$2,$3);} ;
  1633.         | expr2 AUGSEQ expr1 {Baugseq($1,$2,$3);} ;
  1634.         | expr2 AUGSGE expr1 {Baugsge($1,$2,$3);} ;
  1635.         | expr2 AUGSGT expr1 {Baugsgt($1,$2,$3);} ;
  1636.         | expr2 AUGSLE expr1 {Baugsle($1,$2,$3);} ;
  1637.         | expr2 AUGSLT expr1 {Baugslt($1,$2,$3);} ;
  1638.         | expr2 AUGSNE expr1 {Baugsne($1,$2,$3);} ;
  1639.         | expr2 SCANASGN expr1 {Baugques($1,$2,$3);} ;
  1640.         | expr2 AUGAND expr1 {Baugamper($1,$2,$3);} ;
  1641.         | expr2 AUGACT expr1 {Baugact($1,$2,$3);} ;
  1642.  
  1643.  
  1644.  
  1645.  
  1646.                              - 24 -
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655. expr2   : expr3 ;
  1656.         | expr2 TO expr3 {To0($1,$2,$3);} ;
  1657.         | expr2 TO expr3 BY expr3 {To1($1,$2,$3,$4,$5);} ;
  1658.  
  1659.  
  1660. expr3   : expr4 ;
  1661.         | expr4 BAR expr3 {Alt($1,$2,$3);} ;
  1662.  
  1663.  
  1664. expr4   : expr5 ;
  1665.         | expr4 LEXEQ expr5 {Bseq($1,$2,$3);} ;
  1666.         | expr4 LEXGE expr5 {Bsge($1,$2,$3);} ;
  1667.         | expr4 LEXGT expr5 {Bsgt($1,$2,$3);} ;
  1668.         | expr4 LEXLE expr5 {Bsle($1,$2,$3);} ;
  1669.         | expr4 LEXLT expr5 {Bslt($1,$2,$3);} ;
  1670.         | expr4 LEXNE expr5 {Bsne($1,$2,$3);} ;
  1671.         | expr4 NUMEQ expr5 {Beq($1,$2,$3);} ;
  1672.         | expr4 NUMGE expr5 {Bge($1,$2,$3);} ;
  1673.         | expr4 NUMGT expr5 {Bgt($1,$2,$3);} ;
  1674.         | expr4 NUMLE expr5 {Ble($1,$2,$3);} ;
  1675.         | expr4 NUMLT expr5 {Blt($1,$2,$3);} ;
  1676.         | expr4 NUMNE expr5 {Bne($1,$2,$3);} ;
  1677.         | expr4 EQUIV expr5 {Beqv($1,$2,$3);} ;
  1678.         | expr4 NOTEQUIV expr5 {Bneqv($1,$2,$3);} ;
  1679.  
  1680.  
  1681. expr5   : expr6 ;
  1682.         | expr5 CONCAT expr6 {Bcat($1,$2,$3);} ;
  1683.         | expr5 LCONCAT expr6 {Blcat($1,$2,$3);} ;
  1684.  
  1685.  
  1686. expr6   : expr7 ;
  1687.         | expr6 PLUS expr7 {Bplus($1,$2,$3);} ;
  1688.         | expr6 DIFF expr7 {Bdiff($1,$2,$3);} ;
  1689.         | expr6 UNION expr7 {Bunion($1,$2,$3);} ;
  1690.         | expr6 MINUS expr7 {Bminus($1,$2,$3);} ;
  1691.  
  1692.  
  1693. expr7   : expr8 ;
  1694.         | expr7 STAR expr8 {Bstar($1,$2,$3);} ;
  1695.         | expr7 INTER expr8 {Binter($1,$2,$3);} ;
  1696.         | expr7 SLASH expr8 {Bslash($1,$2,$3);} ;
  1697.         | expr7 MOD expr8 {Bmod($1,$2,$3);} ;
  1698.  
  1699.  
  1700. expr8   : expr9 ;
  1701.         | expr9 CARET expr8 {Bcaret($1,$2,$3);} ;
  1702.  
  1703.  
  1704. expr9   : expr10 ;
  1705.         | expr9 BACKSLASH expr10 {Blim($1,$2,$3);} ;
  1706.         | expr9 AT expr10 {Bact($1,$2,$3);};
  1707.         | expr9 BANG expr10 {Apply($1,$2,$3);};
  1708.  
  1709.  
  1710.  
  1711.  
  1712.                              - 25 -
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721. expr10  : expr11 ;
  1722.         | AT expr10 {Uat($1,$2);} ;
  1723.         | NOT expr10 {Unot($1,$2);} ;
  1724.         | BAR expr10 {Ubar($1,$2);} ;
  1725.         | CONCAT expr10 {Uconcat($1,$2);} ;
  1726.         | LCONCAT expr10 {Ulconcat($1,$2);} ;
  1727.         | DOT expr10 {Udot($1,$2);} ;
  1728.         | BANG expr10 {Ubang($1,$2);} ;
  1729.         | DIFF expr10 {Udiff($1,$2);} ;
  1730.         | PLUS expr10 {Uplus($1,$2);} ;
  1731.         | STAR expr10 {Ustar($1,$2);} ;
  1732.         | SLASH expr10 {Uslash($1,$2);} ;
  1733.         | CARET expr10 {Ucaret($1,$2);} ;
  1734.         | INTER expr10 {Uinter($1,$2);} ;
  1735.         | TILDE expr10 {Utilde($1,$2);} ;
  1736.         | MINUS expr10 {Uminus($1,$2);} ;
  1737.         | NUMEQ expr10 {Unumeq($1,$2);} ;
  1738.         | NUMNE expr10 {Unumne($1,$2);} ;
  1739.         | LEXEQ expr10 {Ulexeq($1,$2);} ;
  1740.         | LEXNE expr10 {Ulexne($1,$2);} ;
  1741.         | EQUIV expr10 {Uequiv($1,$2);} ;
  1742.         | UNION expr10 {Uunion($1,$2);} ;
  1743.         | QMARK expr10 {Uqmark($1,$2);} ;
  1744.         | NOTEQUIV expr10 {Unotequiv($1,$2);} ;
  1745.         | BACKSLASH expr10 {Ubackslash($1,$2);} ;
  1746. expr11  : literal ;
  1747.         | section ;
  1748.         | return ;
  1749.         | if ;
  1750.         | case ;
  1751.         | while ;
  1752.         | until ;
  1753.         | every ;
  1754.         | repeat ;
  1755.         | CREATE expr {Create($1,$2);} ;
  1756.         | IDENT {Var($1);} ;
  1757.         | NEXT {Next($1);} ;
  1758.         | BREAK nexpr {Break($1,$2);} ;
  1759.         | LPAREN exprlist RPAREN {Paren($1,$2,$3);} ;
  1760.         | LBRACE compound RBRACE {Brace($1,$2,$3);} ;
  1761.         | LBRACK exprlist RBRACK {Brack($1,$2,$3);} ;
  1762.         | expr11 LBRACK nexpr RBRACK {Subscript($1,$2,$3,$4);} ;
  1763.         | expr11 LBRACE RBRACE {Pdco0($1,$2,$3);} ;
  1764.         | expr11 LBRACE pdcolist RBRACE {Pdco1($1,$2,$3,$4);} ;
  1765.         | expr11 LPAREN exprlist RPAREN {Invoke($1,$2,$3,$4);} ;
  1766.         | expr11 DOT IDENT {Field($1,$2,$3);} ;
  1767.         | CONJUNC FAIL {Kfail($1,$2);} ;
  1768.         | CONJUNC IDENT {Keyword($1,$2);} ;
  1769.  
  1770.  
  1771. while   : WHILE expr {While0($1,$2);} ;
  1772.         | WHILE expr DO expr {While1($1,$2,$3,$4);} ;
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.                              - 26 -
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787. until   : UNTIL expr {Until0($1,$2);} ;
  1788.         | UNTIL expr DO expr {Until1($1,$2,$3,$4);} ;
  1789.  
  1790.  
  1791. every   : EVERY expr {Every0($1,$2);} ;
  1792.         | EVERY expr DO expr {Every1($1,$2,$3,$4);} ;
  1793.  
  1794.  
  1795. repeat  : REPEAT expr {Repeat($1,$2);} ;
  1796.  
  1797.  
  1798. return  : FAIL {Fail($1);} ;
  1799.         | RETURN nexpr {Return($1,$2);} ;
  1800.         | SUSPEND nexpr {Suspend0($1,$2);} ;
  1801.         | SUSPEND expr DO expr {Suspend1($1,$2,$3,$4);};
  1802.  
  1803.  
  1804. if      : IF expr THEN expr {If0($1,$2,$3,$4);} ;
  1805.         | IF expr THEN expr ELSE expr {If1($1,$2,$3,$4,$5,$6);} ;
  1806.  
  1807.  
  1808. case    : CASE expr OF LBRACE caselist RBRACE {Case($1,$2,$3,$4,$5,$6);} ;
  1809.  
  1810.  
  1811. caselist        : cclause ;
  1812.         | caselist SEMICOL cclause {Caselist($1,$2,$3);} ;
  1813.  
  1814.  
  1815. cclause : DEFAULT COLON expr {Cclause0($1,$2,$3);} ;
  1816.         | expr COLON expr {Cclause1($1,$2,$3);} ;
  1817.  
  1818.  
  1819. exprlist        : nexpr
  1820.         | exprlist COMMA nexpr {Exprlist($1,$2,$3);} ;
  1821.  
  1822.  
  1823. pdcolist        : nexpr {
  1824.                 Pdcolist0($1);
  1825.                 } ;
  1826.         | pdcolist COMMA nexpr {
  1827.                 Pdcolist1($1,$2,$3);
  1828.                 } ;
  1829.  
  1830.  
  1831. literal : INTLIT {Iliter($1);} ;
  1832.         | REALLIT {Rliter($1);} ;
  1833.         | STRINGLIT {Sliter($1);} ;
  1834.         | CSETLIT {Cliter($1);} ;
  1835.  
  1836.  
  1837. section : expr11 LBRACK expr sectop expr RBRACK {Section($1,$2,$3,$4,$5,$6);} ;
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.                              - 27 -
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853. sectop  : COLON {Colon($1);} ;
  1854.         | PCOLON {Pcolon($1);} ;
  1855.         | MCOLON {Mcolon($1);} ;
  1856.  
  1857.  
  1858. compound        : nexpr ;
  1859.         | nexpr SEMICOL compound {Compound($1,$2,$3);} ;
  1860.  
  1861.  
  1862. program : error decls EOFX ;
  1863. proc    : prochead error procbody END ;
  1864. expr    : error ;
  1865. %%
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.                              - 28 -
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.        Appendix B - Specifications for the Identity Translator
  1920.  
  1921.  
  1922.  
  1923. %{
  1924. nodeptr q();
  1925. nodeptr cat();
  1926. %}
  1927.  
  1928.  
  1929. #  Declaration Syntax
  1930. #
  1931. #      declarations
  1932. #
  1933. %{
  1934. #define Globdcl(x)  if (!nocode) treeprt(x); treeinit()
  1935. #define Linkdcl(x)  if (!nocode) treeprt(x); treeinit()
  1936. #define Procdcl(x)  if (!nocode) treeprt(x); treeinit()
  1937. #define Recdcl(x)   if (!nocode) treeprt(x); treeinit()
  1938. %}
  1939.  
  1940.  
  1941. #
  1942. #      syntax subsidiary to declarations
  1943. #
  1944. Arglist1()          ""
  1945. Arglist2(x)         x
  1946. Arglist3(x)         x       "[]"
  1947. Global0(x)          ""
  1948. Global1(x,y,z)      "global "       z       "\n"
  1949. Initial1()          ""
  1950. Initial2(x,y,z)     "initial "      y       ";\n"
  1951. Link(x,y)           "link " y       "\n"
  1952. Lnkfile1(x)         x
  1953. Lnkfile2(x)         "\""    x       "\""
  1954. Lnklist(x,y,z)      x       ","     z
  1955. Local(x)            "local "
  1956. Locals1()           ""
  1957. Locals2(w,x,y,z)    w       x       y       ";\n"
  1958. Record1(x)          ""
  1959. Proc1(u,v,w,x,y,z)  u       ";\n"   w       x       y       "end\n"
  1960. Record2(u,v,w,x,y,z)        "record "       w       "("     y")\n"
  1961. Procbody1()         ""
  1962. Procbody2(x,y,z)    x       ";\n"   z
  1963. Prochead1(x)        ""
  1964. Prochead2(u,v,w,x,y,z)      "procedure "    w       "("     y")"
  1965. Static(x)