pax_global_header00006660000000000000000000000064141412670510014513gustar00rootroot0000000000000052 comment=82b56681d961a21bb390a8e7c0525bb155e4942f lola-1.6/000077500000000000000000000000001414126705100123105ustar00rootroot00000000000000lola-1.6/.gitignore000066400000000000000000000001201414126705100142710ustar00rootroot00000000000000pycalc_gram.py calc-gram.h *.o **/*.dSYM **/__pycache/ **/*.pyc lola pycalc calclola-1.6/LICENSE000066400000000000000000001045131414126705100133210ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . lola-1.6/Makefile000066400000000000000000000030201414126705100137430ustar00rootroot00000000000000# # Copyright © 2019 Keith Packard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # CFLAGS=-g -O2 -I. -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs DESTDIR = PREFIX = /usr/local BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man all: lola calc pycalc lola: lola.py cp lola.py lola chmod +x lola calc: calc.c calc-gram.h cc $(CFLAGS) -o $@ calc.c calc-gram.h: calc-gram.ll lola.py python3 ./lola.py -o $@ calc-gram.ll pycalc: pycalc.py pycalc_gram.py cp pycalc.py $@ chmod +x pycalc pycalc_gram.py: pycalc_gram.ll lola.py python3 ./lola.py -o $@ --format=python pycalc_gram.ll install: lola lola.1 install -d $(DESTDIR)$(BINDIR) install lola $(DESTDIR)$(BINDIR) install -d $(DESTDIR)$(MANDIR)/man1 install lola.1 $(DESTDIR)$(MANDIR)/man1 clean: rm -f lola calc pycalc calc-gram.h pycalc_gram.py lola-1.6/README.md000066400000000000000000000155331414126705100135760ustar00rootroot00000000000000# Lola — an LL parser table generator Lola is a parser generator along the lines of yacc or bison, but instead of handling LALR grammars, it only supports LL grammars. This simplification makes the resulting parser much smaller, but of course is only suitable if the target language is actually LL. Lola was originally written over thirty years ago in a long-lost dialect of lisp called Kalypso. I've transliterated it into python, but I haven't tried to make it look like reasonable code. ## Input Syntax The original kalypso version just used lists for the input. Python doesn't exactly make that easy to manage, so I create a simple parser (written in python data structures), and a python parser engine to generate suitable data structures from a more usable input format which looks much like yacc. I've used the grammar of the input format to demonstrate the input format: start : non-term start | ; non-term : SYMBOL @NONTERM@ COLON rules @RULES@ SEMI ; rules : rule rules-p ; rules-p : VBAR rule rules-p | ; rule : symbols @RULE@ ; symbols : SYMBOL @SYMBOL@ symbols | ; ## Actions Instead of assuming C syntax for actions with matching curly braces, actions are just sequences of characters bounded by @ signs, to include a literal @ within the action, just use two @ signs. The goal is to let you use lola with any language by creating a new parser framework and inserting the actions as appropriate. Each parser can do whatever is appropriate with the contents of the actions. ## Parser Operation The generated parse tables map a (terminal, non-terminal) pair into one of the productions in the grammar. The parser has two pieces of state -- a stack of tokens and a current input terminal. The parser works as follows: 1) If the parse stack is not empty, pop an entry from the parse stack, call it 'top'. 2) If 'top' is an action, then execute it and go back to 1) 3) If we don't have an input token, read one from the lexer, call this 'token' 4) If 'token' is end-of-file, then check if the parse stack is empty. If so, we're done. Otherwise, we have a syntax error. 5) If 'top' is a terminal, then check if it matches 'token'. If so, discard 'token' and go back to 1). 6) Otherwise, 'top' must be a non-terminal. Check in the parse table for and entry matching ('token', 'top'). If one exists, push the resulting production tokens on the stack and go back to 1). Otherwise, we have a syntax error. Note that 'actions' are executed *before* a token is read from input. This allows them to operate on the just-matched input token value, and also at end-of-file. ## C Framework The current C output code generates a header file that defines the tokens, specifies a parser that includes the actions as case elements of a switch statement. All of this is generated in a single C header file, which makes incorporating it into build system straightforward. ### The Generated C Header The header file has four parts. Each part is protected by #ifdefs, so this single header file can be used multiple times, extracting the desired information by selecting the desired bits. 1) An enum containing all of the tokens used in the grammar, terminals non-terminals and actions. This is to be used by the lexer to pass terminals into the parser. All of the terminals are spelled as they appeared in the grammar. Non-terminals are prefixed by 'NON_TERMINAL_', actions are 'ACTION_' followed by a number. Both of those shouldn't be used outside of the parser itself. In all cases, '-' characters are replaced by '_'. This section is selected when no #defines naming other sections are specified. 2) The parse tables. This section is selected with #define GRAMMAR_TABLE 3) An array of token names, indexed by token value. This is useful when debugging a grammar during development. This section is selected with #define TOKEN_NAMES 4) The parser. This is a pile of C code which uses the other data from the file to parse input. This section is selected with #define PARSE_CODE Actions in the parser are expected to be C fragments and are inserted into the body of the parse function. The parse function is declared as: typedef enum { parse_return_success, parse_return_syntax, parse_return_end, parse_return_oom, } parse_return_t; token_t lex(void *lex_context); static parse_return_t parse(void *lex_context); It passes the 'lex_context' value to the lex function, which must be declared by the enclosing application. ### Building a C Parser Here's an outline of a C parser. For this example, assume that the name of the generated header file is 'test-gram.h'. #include "test-gram.h" #define PARSE_STACK_SIZE 32 static token_t lex(void *lex_context) { ... } #define GRAMMAR_TABLE #define PARSE_CODE #include "test-gram.h" bool my_parser(void) { return parse(NULL) == parse_return_success; } If you add a '#define PARSE_DEBUG' before including the parse code, then the parser operation will be printed to stdout during operation. This code uses the token names, and so you will also need to add '#define TOKEN_NAMES' as well. ## Calculator Example This repository includes a simple 4-function calculator example that demonstrates how to interpret the parse tables and use the rest of the generated header file. ## Future Ideas While lola is already useful, I've got some ideas on how to improve it. ### Automatic Grammar Transformations One of the restrictions of the current parser is that the selection of a production can only depend on the current input token and non-terminal on the top of the stack. This often requires inserting additional non-terminals and productions into the grammar. There are a set of grammar transformations which can be applied automatically to simpify writing lola grammars. The kalypso code includes a tool called 'flo' which does left-common-subexpression factoring. That might be an interesting place to start. ### Better Error Detection Lola does only limited checking of the specified language; many non-LL languages can be specified and will generate output. Of course, the resulting output will only recognize an LL language related (in some way) to the desired language. Incorporating additional checks within lola to validate the input would help avoid errors here. ### Synthetic Attribute Tracking Actions within a lola grammar get no help from the parser with managing attributes. In yacc, each token in a production is assigned an attribute value, making writing actions much clearer and more straightforward. I'd like to do something similar in lola. I think this would involve creating an attribute stack and then decorating the parse tables with implicit actions to manage that during evaluation of the parse tables, pushing values as tokens in the production are processed, and popping a list of values when the final token for a production is handled. lola-1.6/calc-gram.ll000066400000000000000000000102031414126705100144630ustar00rootroot00000000000000# # Copyright © 2019 Keith Packard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # # The parser operation is table driven -- the parse table # is a set of mappings from (terminal,non-terminal) to (token ...), # with (token ...) including terminals, non-terminals and actions. # # There is a parse stack of tokens. Depending on the type of the token on the # top of the parse stack, three different actions are taken. # # 1) When the top of the parse stack is a non-terminal, it is replaced # by the contents of the parse table entry cooresponding to the # current input terminal and top of stack non-terminal # # 2) When the top of the parse stack is a terminal, it must match # the current input terminal. The top of stack is discarded and # another input token read. # # 3) When the top of the parse stack is an action, it is executed # # Because of this operation, actions wanting to use the value of the # current input terminal are placed *before* the token itself. This is # guaranteed to work as the only way to get to the production is if # the input terminal is of the correct type. # # Actions wanting to be executed after the actions within one of the productions # of a non-terminal are placed *after* the non-terminal. Otherwise, they would # be executed before the actions within the non-terminal production due to the # order of tokens pulled from the stack. # # The syntax is pretty simple, and is designed to mirror the usual # yacc syntax. # # Actions are any sequence of characters enclosed in # @. Use two @ signs to include an actual @ in the action. # # What I'd like to figure out is how to automate the management # of the value stack so that actions can associate values # with the non-terminal associated with the production in which # they occur. This would make them work more like yacc actions as # values could then be synthesized upwards in the grammar # # Perhaps a special token could be placed on the stack at the end of # each sequence of tokens that replace a non-terminal, and this token # could signal suitable value stack handling? That would need to know # the number of elements that had been in the production when it was # placed on the parse stack to know how many values to remove from the # value stack, it would then drop that number of elements from the # value stack and push the value computed by the last action within # the production # # A calculator session is a sequence of lines start : line start | ; # A line is an expression followed by a newline, or just a newline # alone. # # The C code implementing the calculator provides a numeric stack with # push/pop functions. Note that this set of actions is responsible for # maintaining that stack correctly; errors will terminate the parser, and so # the stack could be re-initialized when the parser is restarted. # line : expr NL @{ printf("%g\n", pop()); }@ | NL ; # Three levels of precedence, (+ -), (* /) and then unary # minus/parenthesized exprs expr : term expr-p ; expr-p : PLUS term @{ double b = pop(); double a = pop(); push(a + b); }@ expr-p | MINUS term @{ double b = pop(); double a = pop(); push(a - b); }@ expr-p | ; term : fact term-p ; term-p : TIMES fact @{ double b = pop(); double a = pop(); push(a * b); }@ term-p | DIVIDE fact @{ double b = pop(); double a = pop(); push(a / b); }@ term-p | ; fact : OP expr CP | MINUS fact @{ double a = pop(); push(-a); }@ | NUMBER @{ push(lex_value); }@ ; lola-1.6/calc.c000066400000000000000000000047221414126705100133630ustar00rootroot00000000000000/* * Copyright © 2019 Keith Packard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include "calc-gram.h" #define PARSE_STACK_SIZE 32 static int lex_c = 0; static int in_c(void) { int c; if (lex_c != 0) { c = lex_c; lex_c = 0; } else { c = getchar(); } return c; } static void un_in_c(int c) { lex_c = c; } static double lex_value; static token_t lex(void *lex_context) { for (;;) { int c = in_c(); switch (c) { case EOF: return END; case '+': return PLUS; case '-': return MINUS; case '*': return TIMES; case '/': return DIVIDE; case '(': return OP; case ')': return CP; case '\n': return NL; } if ('0' <= c && c <= '9') { char num_buf[32]; int num_cnt = 0; while (isdigit(c)) { num_buf[num_cnt++] = c; c = in_c(); } if (c == '.') { num_buf[num_cnt++] = c; c = in_c(); while (isdigit(c)) { num_buf[num_cnt++] = c; c = in_c(); } } if (c == 'e') { num_buf[num_cnt++] = c; c = in_c(); if (c == '-' || c == '+') { num_buf[num_cnt++] = c; c = in_c(); } while (isdigit(c)) { num_buf[num_cnt++] = c; c = in_c(); } } num_buf[num_cnt++] = '\0'; un_in_c(c); lex_value = strtod(num_buf, NULL); return NUMBER; } } } static double value_stack[32]; static int value_stack_p = 0; static void push(double value) { value_stack[value_stack_p++] = value; } static double pop(void) { return value_stack[--value_stack_p]; } #define GRAMMAR_TABLE #define TOKEN_NAMES #define PARSE_CODE #include "calc-gram.h" int main(int argc, char **argv) { parse(NULL); return 0; } lola-1.6/flo000077500000000000000000000134561414126705100130270ustar00rootroot00000000000000#!/local/bin/kalypso ; ; Copyright © 2019 Keith Packard ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, but ; WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; General Public License for more details. ; ; You should have received a copy of the GNU General Public License along ; with this program; if not, write to the Free Software Foundation, Inc., ; 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ; ; ; flo ; ; factor left common expressions out of a grammar ; ; ; remove the first element from each of a list ; of productions (unless the production is nil) ; (defun clip-firsts (productions) (cond (productions (cond ((car productions) (cons (caar productions) (clip-firsts (cdr productions))) ) (t (clip-firsts (cdr productions))) ) ) (t nil) ) ) ; ; return the first duplicated element from a list of elements ; (defun has-common (firsts) (cond ((nil? firsts) nil) ((member? (car firsts) (cdr firsts)) (car firsts)) (t (has-common (cdr firsts))) ) ) ; ; return a list of productions which have the given ; element as their first member ; (defun with-first (productions first) (cond ((nil? productions) nil) ((= (caar productions) first) (cons (car productions) (with-first (cdr productions) first)) ) (t (with-first (cdr productions) first)) ) ) ; ; return a list of productions which *don't* have the given ; element as their first member ; (defun without-first (productions first) (cond ((nil? productions) nil) ((not (= (caar productions) first)) (cons (car productions) (without-first (cdr productions) first)) ) (t (without-first (cdr productions) first)) ) ) ; ; strip the first 'count' elements off a list of productions ; (defun remove-firsts (productions count) (cond ((nil? productions) nil) (t (cons (nthcdr count (car productions)) (remove-firsts (cdr productions) count ) ) ) ) ) ; ; return 't if each production in the list has the same first ; element ; (defun all-common-first (productions) (cond ((and productions (cdr productions)) (cond ((or (and (nil? (car productions)) (nil? (cadr productions)) ) (and (car productions) (cadr productions) (= (caar productions) (caadr productions)) ) ) (all-common-first (cdr productions)) ) (t nil) ) ) (t) ) ) ; ; return the maximal list of common first sub-lists ; from a set of productions ; (defun max-common (productions) (cond ((all-common-first productions) (cons (caar productions) (max-common (remove-firsts productions 1)) ) ) (t nil) ) ) ; ; factor out common left sub-lists from the list ; of productions associated with a particular non-terminal ; (defun eliminate-common (non-terminal dictionary) (let ((productions (eval non-terminal)) (firsts) (common) (common-list) (removed) (new) (new-name) ) (setq firsts (clip-firsts productions)) (setq common (has-common firsts)) (cond (common (setq removed (with-first productions common)) (setq common-list (max-common removed)) (setq new-name (get-name non-terminal)) (setq new t) ; ; generate a name for the new non-terminal ; keep appending "p" until it's new ; (while new (setq new-name (strcat new-name "p")) (setq new (dictionary-lookup dictionary new-name)) ) (setq new (symbol new-name dictionary)) (set new (remove-firsts removed (length common-list))) (set non-terminal (cons (conc common-list (list new)) (without-first productions common)) ) (cons new (conc (eliminate-common new dictionary) (eliminate-common non-terminal dictionary) ) ) ) (t nil) ) ) ) ; ; remove common left sub-expressions from each non-terminal ; in the grammar ; (defun factor-left (non-terminals) (let ((l) (new)) (setq l non-terminals) (while l (setq new (eliminate-common (car l) flo-dictionary)) (cond (new (setq non-terminals (conc non-terminals new)) ) ) (setq l (cdr l)) ) non-terminals ) ) (defun to-non-terminal-list (grammar) (if grammar (let ((name (caar grammar))) (set name (cdar grammar)) (cons name (to-non-terminal-list (cdr grammar))) ) else nil ) ) (defun from-non-terminal-list (non-terminals) (cond (non-terminals (cons (cons (car non-terminals) (eval (car non-terminals))) (from-non-terminal-list (cdr non-terminals)) ) ) (nil) ) ) (defun print-productions (productions) (cond (productions (patom "\t") (cond ((car productions) (print (car productions)) ) (t (patom "()")) ) (terpr) (print-productions (cdr productions)) ) ) ) (defun print-one-set (set) (patom " (") (print (car set)) (terpr) (print-productions (cdr set)) (patom "\t)\n") ) (defun print-grammars (grammar) (cond (grammar (print-one-set (car grammar)) (print-grammars (cdr grammar)) ) ) ) (defun print-grammar (grammar) (patom "(\n") (print-grammars grammar) (patom " )\n") ) (defun flo-file (fd) (setq flo-dictionary (new-dictionary)) (setq grammar (fread-dictionary fd flo-dictionary)) (setq non-terminals (to-non-terminal-list grammar)) (setq result (from-non-terminal-list (factor-left non-terminals))) (print-grammar result) ) (setq file-in stdin) (setq argv (cdr argv)) (if argv (setq file-in (fopen (car argv) 'r)) (if (nil? file-in) (error (strcat "flo: can't open " (sprint (car argv)))) ) ) (flo-file file-in) lola-1.6/flo.py000066400000000000000000000113301414126705100134400ustar00rootroot00000000000000#!/usr/bin/env python3 # # Copyright © 2019 Keith Packard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # grammar = { "lines" : (("line", "lines"), () ), "line" : (("expr", "#PRINT", "NL"), ("NL",), ), "expr" : (("term", "PLUS", "expr", "#ADD"), ("term", "MINUS", "expr", "#SUBTRACT"), ("term",) ), "term" : (("fact", "term-p"), ), "term-p" : (("TIMES", "fact", "#TIMES", "term-p"), ("DIVIDE", "fact", "#DIVIDE", "term-p"), (), ), "fact" : (("OP", "expr", "CP"), ("MINUS", "fact", "#NEGATE"), ("#PUSH", "NUMBER"), ) } def productions(non_terminal): return grammar[non_terminal] # flo # # factor left common expressions out of a grammar # def head(list): return list[0] def rest(list): return list[1:] def nthrest(list, n): return list[n:] def error(msg): print(msg) exit(1) # # remove the first element from each of a list # of productions (unless the production is nil) # def clip_firsts(prods): ret = () for prod in prods: if prod: ret += (head(prod),) return ret # # return the first duplicated element from a list of elements # def find_common(firsts): while firsts: f = head(firsts) firsts = rest(firsts) if f in firsts: return f # # return a list of productions which have the given # element as their first member # def with_first(prods, first): ret = () for prod in prods: if first == head(prod): ret = ret + (prod,) return ret # # return a list of productions which *don't* have the given # element as their first member # def without_first (prods, first): ret = () for prod in prods: if first != head(prod): ret = ret + (prod,) return ret # # strip the first 'count' elements off a list of productions # def remove_firsts (prods, count): ret = () for prod in prods: ret = ret + (nthrest(prod, count),) return ret # # return True if each production in the list has the same first # element # def all_common_first(prods): while len(prods) >= 2: if head(prods[0]) != head(prods[1]): return False prods = rest(prods) return True # # return the maximal list of common first sub-lists # from a set of productions # def max_common(prods): ret = () while all_common_first(prods): ret = ret + (head(prods[0]),) prods = remove_firsts(prods, 1) return ret # # factor out common left sub-lists from the list # of productions # def eliminate_common(non_terminal): prods = productions(non_terminal) firsts = clip_firsts(prods) common = find_common(firsts) if common: removed = with_first(prods, common) remain = without_first(prods, common) common_list = max_common(removed) new_non_terminal = non_terminal while True: new_non_terminal = new_non_terminal + "-p" if new_non_terminal not in grammar: break grammar[new_non_terminal] = remove_firsts(removed, len(common_list)) grammar[non_terminal] = ((common_list + (new_non_terminal,)),) + remain # # remove common left sub-expressions from each non-terminal # in the grammar # def factor_left(non_terminals): for non_terminal in non_terminals: eliminate_common(non_terminal) def get_non_terminals(grammar): non_terminals = () for e in grammar: non_terminals += (e,) return non_terminals def dump_grammar(grammar): for nt,prods in grammar.items(): print("%s" % nt) started = False for prod in prods: label = ":" if started: label = "|" print("\t%s %s" % (label, prod)) started = True print("\t;") def flo(): factor_left(get_non_terminals(grammar)) flo() dump_grammar(grammar) lola-1.6/lola-gram.ll000066400000000000000000000003361414126705100145160ustar00rootroot00000000000000start : non-term start | ; non-term : SYMBOL @NONTERM@ COLON rules @RULES@ SEMI ; rules : rule rules-p ; rules-p : VBAR rule rules-p | ; rule : symbols @RULE@ ; symbols : SYMBOL @SYMBOL@ symbols | ; lola-1.6/lola.1000066400000000000000000000016711414126705100133260ustar00rootroot00000000000000.\" .\" Copyright © 2019 Keith Packard .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation, either version 2 of the License, or .\" (at your option) any later version. .\" .\" This program is distributed in the hope that it will be useful, but .\" WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU .\" General Public License for more details. .\" .TH LOLA 1 "lola" "" .SH NAME lola \- LL parser generator .SH SYNOPSIS .B "lola" [--format c|python] [--output filename] [-Dname] grammar.ll .SH DESCRIPTION .I lola is a general purpose parser generator for context-free LL languages. It can generate a C program or Python data structure to parse the language represented by context-free LL grammars. .SH AUTHOR Keith Packard lola-1.6/lola.py000077500000000000000000001140261414126705100136200ustar00rootroot00000000000000#!/usr/bin/env python3 # coding: utf-8 # # Copyright © 2019 Keith Packard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # import argparse import collections import pprint import re import sys actions_marker = "@@ACTIONS@@" parse_code = """ static token_t parse_stack[PARSE_STACK_SIZE]; #if PARSE_STACK_SIZE < 256 typedef uint8_t parse_stack_p_t; #else #if PARSE_STACK_SIZE < 65536 typedef uint16_t parse_stack_p_t; #else typedef uint32_t parse_stack_p_t; #endif #endif #if NON_TERMINAL_SIZE < 256 typedef uint8_t non_terminal_index_t; #else #if NON_TERMINAL_SIZE < 65536 typedef uint16_t non_terminal_index_t; #else typedef uint32_t non_terminal_index_t; #endif #endif #ifndef PARSE_TABLE_FETCH_TOKEN #define PARSE_TABLE_FETCH_TOKEN(addr) (*(addr)) #endif #ifndef PARSE_TABLE_FETCH_INDEX #define PARSE_TABLE_FETCH_INDEX(addr) (*(addr)) #endif static const token_t * match_state(token_t terminal, token_t non_terminal) { token_key_t terminal_key = terminal; if (terminal_key >= sizeof(terminal_table) / sizeof(terminal_table[0])) return NULL; non_terminal_index_t non_term = non_terminal_index(PARSE_TABLE_FETCH_INDEX(&terminal_table[terminal_key])); for (;;) { uint8_t i = PARSE_TABLE_FETCH_INDEX(&non_terminal_table[non_term]); if (i == 0xfe) { i = PARSE_TABLE_FETCH_INDEX(&non_terminal_table[non_term+1]); non_term = non_terminal_index(i); } else if (i == 0xff) { break; } else { const token_t *production = &production_table[production_index(i)]; if (PARSE_TABLE_FETCH_TOKEN(production) == non_terminal) { return production + 1; } non_term++; } } return NULL; } static inline token_t parse_pop(int *parse_stack_p) { if ((*parse_stack_p) == 0) return TOKEN_NONE; return parse_stack[--(*parse_stack_p)]; } static inline bool parse_push(const token_t *tokens, int *parse_stack_p) { token_t token; while ((token = PARSE_TABLE_FETCH_TOKEN(tokens++)) != TOKEN_NONE) { if ((*parse_stack_p) >= PARSE_STACK_SIZE) return false; parse_stack[(*parse_stack_p)++] = token; } return true; } static inline bool is_terminal(token_t token) { return token < FIRST_NON_TERMINAL; } static inline bool is_action(token_t token) { return token >= FIRST_ACTION; } static inline bool is_non_terminal(token_t token) { return !is_terminal(token) && !is_action(token); } typedef enum { parse_return_success, parse_return_syntax, parse_return_end, parse_return_oom, parse_return_error, } __attribute__((packed)) parse_return_t; static parse_return_t parse(void *lex_context) { token_t token = TOKEN_NONE; int parse_stack_p = 0; #ifdef PARSE_TOP PARSE_TOP #endif parse_stack[parse_stack_p++] = NON_TERMINAL_start; for (;;) { token_t top = parse_pop(&parse_stack_p); if (is_action(top)) { switch(top) { @@ACTIONS@@ default: break; } #ifdef PARSE_ACTION_BOTTOM PARSE_ACTION_BOTTOM; #endif continue; } if (token == TOKEN_NONE) token = lex(lex_context); if (top == TOKEN_NONE) { if (token != END) return parse_return_syntax; return parse_return_success; } #ifdef PARSE_DEBUG { int i; #ifdef token_name printf("%-15s : %s", token_names[token], token_names[top]); for (i = parse_stack_p-1; i >= 0; i--) { if (!is_action(parse_stack[i])) printf(" %s", token_names[parse_stack[i]]); else printf(" <%d>", parse_stack[i]); } #else printf("token %d stack %d", token, top); for (i = parse_stack_p-1; i >= 0; i--) printf(" %d", parse_stack[i]); #endif printf("\\n"); } #endif if (is_terminal(top)) { if (top != token) { if (token == END) return parse_return_end; return parse_return_syntax; } token = TOKEN_NONE; } else { const token_t *tokens = match_state(token, top); if (!tokens) return parse_return_syntax; if (!parse_push(tokens, &parse_stack_p)) return parse_return_oom; } } } """ # ll parser table generator # # the format of the grammar is: # # {"non-terminal": (("SYMBOL", "non-terminal", "@action"), (production), (production)), # "non-terminal": ((production), (production), (production)), # } # # The start symbol must be named "start", the EOF token must be named "END" # end_token="END" def productions(grammar, non_terminal): if non_terminal not in grammar: error("Undefined non-terminal %s" % non_terminal) return grammar[non_terminal] # data abstraction # # a non terminal is a string starting with lower case # a terminal is a string starting with upper case # an action is a string starting with '@' # def is_non_terminal(item): return item[0].islower() def is_terminal(item): return item[0].isupper() def is_action(item): return item[0] == '@' def is_null_production(p): if len(p) == 0: return True elif is_action(p[0]): return is_null_production(p[1:]) else: return False start_symbol = "start" def is_start_symbol(item): global start_symbol return item == start_symbol def head(list): return list[0] def rest(list): return list[1:] def fprint(msg, end='\n', file=sys.stdout): file.write(msg) file.write(end) def error(msg): fprint(msg, file=sys.stderr) exit(1) # # generate the first set for the productions # of a non-terminal # def first_set(grammar, non_terminal): ret=() for prod in productions(grammar, non_terminal): if is_null_production(prod): ret += ((),) else: ret += first(grammar, prod) return ret first_list = () def unique(list): if not list: return list f = head(list) r = rest(list) if f in r: return unique(r) else: return (f,) + unique(r) def delete(elt, list): ret = () for i in list: if i != elt: ret = ret + (i,) return ret # # generate the first set for a single symbol This is easy for a # terminal -- the result is the item itself. For non-terminals, the # first set is the union of the first sets of all the productions # that derive the non-terminal # # Note that this also checks to see if the grammar is left-recursive. # This will succeed because a left recursive grammar will always # re-reference a particular non-terminal when trying to generate a # first set containing it. # def first_for_symbol(grammar, item): global first_list if item in first_list: error("lola: left-recursive grammar for symbol %s" % item) first_list = (item,) + first_list ret = False if is_terminal(item): ret = (item,) elif is_non_terminal(item): set = first_set(grammar, item) ret = unique(set) first_list = rest(first_list) return ret # # generate the first list for a production. # # the first list is the set of symbols which are legal # as the first symbols in some possible expansion of the # production. The cases are simple: # # if the (car production) is a terminal, then obviously # the only possible first symbol is that terminal # # Otherwise, generate the first lists for *all* expansions # of the non-terminal (car production). If that list doesn't # contain an epsilon production 'nil, the we're done. Otherwise, # this set must be added to the first set of (cdr production) because # some of the possible expansions of the production will not have any # terminals at all from (car production). # # Note the crufty use of dictionaries to save old expansion of first # sets. This is because both ll and follow call first quite often, # frequently for the same production # first_dictionary = {} def reset_first(): global first_dictionary global first_list first_dictionary = {} first_list = () def first(grammar, production): global first_dictionary while production and is_action(head(production)): production = rest(production) if production in first_dictionary: ret = first_dictionary[production] else: if production: ret = first_for_symbol(grammar, head(production)) if () in ret: ret = delete((), ret) + first(grammar, rest(production)) else: ret = ((),) first_dictionary[production] = ret return ret # # generate the follow set of a for an item in a particular # production which derives a particular non-terminal. # # This is nil if the production does # not contain the item. # # Otherwise, it is the first set for the portion of the production # which follows the item -- if that first set contains nil, then the # follow set also contains the follow set for the non-terminal which # is derived by the production # def follow_in_production(grammar, item, non_terminal, production, non_terminals): # Find all instances of the item in this production; it # may be repeated f = () for i in range(len(production)): if production[i] == item: f += first(grammar, production[i+1:]) if () in f: f = delete((), f) + follow(grammar, non_terminal, non_terminals) return f # # loop through the productions of a non-terminal adding # the follow sets for each one. Note that this will often # generate duplicate entries -- as possibly many of the # follow sets for productions will contain the entire follow # set for the non-terminal # def follow_in_non_terminal (grammar, item, non_terminal, non_terminals): ret = () for prod in productions(grammar, non_terminal): ret += follow_in_production(grammar, item, non_terminal, prod, non_terminals) return ret # # generate the follow set for a particular non-terminal # The only special case is for the # start symbol who's follow set also contains the # end-token # follow_dictionary = {} def reset_follow(): global follow_dictionary follow_dictionary = {} # # A list of in-process follow calls # Use this to avoid recursing into the same # non-terminal # follow_stack = [] def follow(grammar, item, non_terminals): global follow_dictionary, follow_stack if item in follow_dictionary: ret = follow_dictionary[item] else: ret = () follow_stack.append(item) for non_terminal in non_terminals: if non_terminal not in follow_stack: ret += follow_in_non_terminal(grammar, item, non_terminal, non_terminals) follow_stack.pop() if is_start_symbol(item): ret = (end_token,) + ret ret = unique(ret) follow_dictionary[item] = ret return ret # # this makes an entry in the output list, this is just one # of many possible formats # def make_entry(terminal, non_terminal, production): return {(terminal, non_terminal): production} def add_dict(a,b): for key,value in b.items(): if key in a: fprint("multiple productions match %r - %r and %r" % (key, value, a[key]), file=sys.stderr) if len(value) < len(a[key]): continue a[key] = value # # generate the table entries for a particular production # this is taken directly from Aho, Ullman and Seti # # Note: this function uses dynamic scoping -- both non-terminal # and non-terminals are expected to have been set by the caller # def ll_one_production(grammar, production, non_terminal, non_terminals): firsts = first(grammar, production) ret = {} for f in firsts: if not f: follows = follow(grammar, non_terminal, non_terminals) for f in follows: add_dict(ret, make_entry(f, non_terminal, production)) elif is_terminal(f): add_dict(ret, make_entry(f, non_terminal, production)) return ret # # generate the table entries for all productions of # a particular non-terminal # def ll_one_non_terminal(grammar, non_terminal, non_terminals): ret = {} # print("ll_one_non_terminal %r" % non_terminal) for p in productions(grammar, non_terminal): add_dict(ret, ll_one_production(grammar, p, non_terminal, non_terminals)) # print("ll for %r is %r" % (non_terminal, ret)) return ret # # generate the table entries for all the non-terminals # def ll_non_terminals(grammar, non_terminals): ret = {} for non_terminal in non_terminals: add_dict(ret, ll_one_non_terminal(grammar, non_terminal, non_terminals)) return ret def get_non_terminals(grammar): non_terminals = () for non_terminal in grammar: non_terminals += (non_terminal,) return non_terminals def get_terminals(grammar): terminals = ("END",) for non_terminal, prods in grammar.items(): for prod in prods: for token in prod: if is_terminal(token) and not token in terminals: terminals += (token,) return terminals def count_actions(grammar): actions = 0 for non_terminal, prods in grammar.items(): for prod in prods: for token in prod: if is_action(token): actions += 1 return actions def compress_action(action): # trailing comments action = re.sub("//.*\n", "\n", action) # embedded comments action = re.sub("/\*.*?\*/", " ", action) # compress whitespace action = re.sub("\s+", " ", action) # remove leading and trailing whitespace and braces action = action.strip('@ \t\n{}') return action def has_action(actions, action): for a in actions: if compress_action(a) == compress_action(action): return True return False def action_sort(action): return len(compress_action(action)) def get_actions(grammar): actions = () for non_terminal, prods in grammar.items(): for prod in prods: for token in prod: if is_action(token) and not has_action(actions, token): actions += (token,) return sorted(actions, key=action_sort) # # produce a parse table for the given grammar # def ll (grammar): reset_first() reset_follow() non_terminals = get_non_terminals(grammar) return ll_non_terminals(grammar, non_terminals) def dump_table(table, file=sys.stdout): fprint("Parse table", file=file) for key,value in table.items(): fprint("\t%r -> %r" % (key, value), file=file) def dump_grammar(grammar, file=sys.stdout): for non_term, prods in grammar.items(): fprint("%-20.20s" % non_term, end='', file=file) first=True for prod in prods: if first: fprint(":", end='', file=file) first = False else: fprint(" |", end='', file=file) for token in prod: fprint(" %s" % token, end='', file=file) fprint("", file=file) fprint(" ;", file=file) grammar = { start_symbol: (("non-term", start_symbol), () ), "non-term" : (("SYMBOL", "@NONTERM", "COLON", "rules", "@RULES", "SEMI"), ), "rules" : (("rule", "rules-p"), ), "rules-p" : (("VBAR", "rule", "rules-p"), (), ), "rule" : (("symbols", "@RULE"), ), "symbols" : (("SYMBOL", "@SYMBOL", "symbols"), (), ), } lex_c = False lex_file = sys.stdin lex_file_name = "" lex_line = 1 def onec(): global lex_line global lex_file c = lex_file.read(1) if c == '\n': lex_line = lex_line + 1 return c def getc(): global lex_c if lex_c: c = lex_c lex_c = False else: c = onec() if c == '#': while c != '\n': c = onec() return c def ungetc(c): global lex_c lex_c = c lex_value = False def is_symbol_start(c): return c.isalpha() or c == '_' or c == '-' def is_symbol_cont(c): return is_symbol_start(c) or c.isdigit() action_lines = {} def action_line(action): global action_lines return action_lines[action] def mark_action_line(action, line): global action_lines action_lines[action] = line ppsyms = {} def lex_sym(c): v = c while True: c = getc() if is_symbol_cont(c): v += c else: ungetc(c) break; return v def define_pp(name): ppsyms[name] = True def defined_pp(name): return name in ppsyms pp_stack = [] def include_pp(): global pp_stack return len(pp_stack) == 0 or pp_stack[-1] def push_pp(): global pp_stack name = lex_sym(getc()) pp_stack.append(include_pp() and defined_pp(name)) def pop_pp(): global pp_stack if len(pp_stack): pp_stack.pop() def lex(): global lex_value lex_value = False while True: c = getc() if c == '{': push_pp() continue if c == '}': pop_pp() continue if not include_pp(): continue if c == '': return 'END' if c == '|': return "VBAR" if c == ':': return "COLON" if c == ';': return "SEMI" if c == '@': v = c at_line = lex_line while True: c = getc() if c == '': error("Missing @, token started at line %d" % at_line) elif c == '@': c = getc() if c != '@': ungetc(c) break v += c lex_value = v mark_action_line(v, at_line) return "SYMBOL" if is_symbol_start(c): lex_value = lex_sym(c) return "SYMBOL" def lola(): global lex_value global value_stack # Construct the parser for lola input files table = ll(grammar) # Run the lola parser stack = (start_symbol,) token = False result = {} non_term = False prod = () prods = () while True: if stack: top = head(stack) stack = rest(stack) else: top = False if top and is_action(top): if top == "@NONTERM": non_term = lex_value elif top == "@RULES": result[non_term] = prods prods = () non_term = False elif top == "@RULE": prods = prods + (prod,) prod = () elif top == "@SYMBOL": prod = prod + (lex_value,) continue if not token: token = lex() # print("token %r top %r stack %r" % (token, top, stack)) if not top: if token == end_token: return result error("parse stack empty at %r" % token) if is_terminal(top): if top == token: token = False else: error("%s:%d: parse error. got %r expected %r" % (lex_file_name, lex_line, token, top)) else: key = (token, top) if key not in table: error("%s:%d: parse error at %r %r" % (lex_file_name, lex_line, token, top)) stack = table[key] + stack def to_c(string): return string.replace("-", "_") def action_has_name(action): return action[1].isalpha() def action_name(token_values, action): if action_has_name(action): action = to_c(action)[1:] end = action.find(' ') if end != -1: action = action[0:end] return "ACTION_" + action else: return "ACTION_%d" % token_values[compress_action(action)] def action_value(action): if action_has_name(action): end = action.find(' ') if end == -1: return "" else: end = 0 return action[end+1:] def terminal_name(terminal): return to_c(terminal) def terminal_names(terminals): names = None for terminal in terminals: name = terminal_name(terminal) if names: names += " " + name else: names = name return names def non_terminal_name(non_terminal): return "NON_TERMINAL_" + to_c(non_terminal) def token_name(token_values, token): if is_action(token): return action_name(token_values, token) elif is_terminal(token): return terminal_name(token) else: return non_terminal_name(token) def dump_python(grammar, parse_table, file=sys.stdout): fprint('parse_table = \\', file=file) pp = pprint.PrettyPrinter(indent=4, stream=file) pp.pprint(parse_table) def pad(value, round): p = value % round if p != 0: return round - p return 0 c_line = 1 def print_c(string, end='\n', file=None): global c_line c_line += string.count("\n") + end.count("\n") fprint(string, file=file, end=end) def pretty(title, a): print("%s" % title) pp = pprint.PrettyPrinter(indent=4, stream=sys.stdout) pp.pprint(a) def is_subset(sub,sup): return set(sub) - set(sup) == set() def pick_binding(possibles, n): binding = {} for sub, supers in possibles.items(): pick = n % len(supers) n //= len(supers) binding[sub] = supers[pick] if n: return None return binding def pick_binding_simple(possibles, indices): binding = {} for sub, supers in possibles.items(): pick = indices[sub] binding[sub] = supers[pick] return binding def total_bindings(possibles): n = 1 for sub, supers in possibles.items(): n *= len(supers) return n def lookup_optimized(table, binding, terminal, non_terminal): terms = (terminal,) while True: if not terms in table: return False for prod in table[terms]: if prod[0] == non_terminal: return prod if not terms in binding: return False terms = binding[terms] def non_terminal_table(terminals, terminal_map, binding): table = collections.OrderedDict() finished = {} for terminal in terminals: while True: terms = (terminal,) if not terms in terminal_map: break if terms in finished: break # Now follow that to the end of the list of bindings while terms in binding and not binding[terms] in finished: terms = binding[terms] table[terms] = terminal_map[terms] finished[terms] = True for terms, prods in terminal_map.items(): for term in terms: ts = (term,) for prod in prods: if not lookup_optimized(table, binding, term, prod[0]): if not ts in table: table[ts] = () table[ts] += (prod,) return table def prod_size(prod): return len(prod) + 1 def non_terminal_size(table): l = 0 for terms, prods in table.items(): l += len(prods) + 2 return l def optimize(grammar, parse_table, terminals, non_terminals, output): # # Walk over the parse table # and figure out which non-terminal → production # mappings are shared between terminals # non_terminal_map = {} for terminal in terminals: for non_terminal in non_terminals: parse_key = (terminal, non_terminal) if parse_key in parse_table: prod = parse_table[parse_key] prod_key = (non_terminal, prod) if prod_key not in non_terminal_map: non_terminal_map[prod_key] = () non_terminal_map[prod_key] = non_terminal_map[prod_key] + (terminal,) # Now flip that over to generate a map from a set of terminals to the # non-terminal/productions they match terminal_map = {} for prod, terms in non_terminal_map.items(): if terms not in terminal_map: terminal_map[terms] = () terminal_map[terms] += (prod,) possibles = {} # Build possible terminals mappings for each entry in # non_terminal_map. This means, for each set of terminals, # find the list of all supersets for prod_sub, term_sub in non_terminal_map.items(): for prod_sup, term_sup in non_terminal_map.items(): if term_sub != term_sup and is_subset(term_sub, term_sup): # add this set to the list of possible first bindings if not term_sub in possibles: possibles[term_sub] = () if not term_sup in possibles[term_sub]: possibles[term_sub] = possibles[term_sub] + (term_sup,) # Trim possible terminal mappings so that only the smallest subset # along each path is present. This should leave the few entries # for each terminal set which offers real options new_possibles = {} for sub, sups in possibles.items(): new_sups = () for sup in sups: for check in sups: if sup != check and is_subset(check, sup): break else: new_sups = new_sups + (sup,) new_possibles[sub] = new_sups print_c("/*", file=output) print_c(" * Possible graph edges %d total %d minimal" % (total_bindings(possibles), total_bindings(new_possibles)), file=output) if False: print_c(" *", file=output) for terms in possibles: print_c(" *", file=output) print_c(" * all mappings for %s" % (terms,), file=output) for poss in possibles[terms]: print_c(" * %r -> %r" % (terms, poss), file=output) print_c(" *", file=output) print_c(" * minimal mappings for %s" % (terms,), file=output) for poss in new_possibles[terms]: print_c(" * %r -> %r" % (terms, poss), file=output) print_c(" *", file=output) print_c(" */", file=output) possibles = new_possibles # Select a binding using the heuristic that binding to smaller # supersets will be better than larger supersets. An exhaustive # search is 'too expensive' at this point. binding_map = {} for terms in possibles: binding_map[terms] = 0 for terms in possibles: best_i = 0 best_len = -1 possible_len = len(possibles[terms]) # If we have a choice of binding for this # set of terminals, select the one with # the smallest superset if possible_len > 1: for i in range(len(possibles[terms])): super = possibles[terms][i] # Heuristic - select smaller superset l = len(super) if best_len == -1 or l < best_len: best_i = i best_len = l binding_map[terms] = best_i # Construct the final binding and non-terminal table best_binding_simple = pick_binding_simple(possibles, binding_map) best_table_simple = non_terminal_table(terminals, terminal_map, best_binding_simple) best_len_simple = non_terminal_size(best_table_simple) return (best_binding_simple, best_table_simple) def dump_c(grammar, parse_table, file=sys.stdout, filename=""): output=file terminals = get_terminals(grammar) num_terminals = len(terminals) non_terminals = get_non_terminals(grammar) num_non_terminals = len(non_terminals) actions = get_actions(grammar) num_actions = len(actions) print_c("/* %d terminals %d non_terminals %d actions (%d duplicates) %d parse table entries */" % (num_terminals, num_non_terminals, num_actions, count_actions(grammar) - num_actions, len(parse_table)), file=output) print_c("", file=output) print_c("#if !defined(GRAMMAR_TABLE) && !defined(TOKEN_NAMES) && !defined(PARSE_CODE)", file=output) print_c("typedef enum {", file=output) print_c(" TOKEN_NONE = 0,", file=output) token_value = {} value = 1 first_terminal = value for terminal in terminals: token_value[terminal] = value print_c(" %s = %d," % (terminal_name(terminal), value), file=output) value += 1 first_non_terminal = value print_c(" FIRST_NON_TERMINAL = %d," % first_non_terminal, file=output) for non_terminal in non_terminals: token_value[non_terminal] = value print_c(" %s = %d," % (non_terminal_name(non_terminal), value), file=output) value += 1 print_c(" FIRST_ACTION = %d," % value, file=output) for action in actions: token_value[compress_action(action)] = value print_c(" %s = %d, // %s" % (action_name(token_value, action), value, compress_action(action)), file=output) value += 1 print_c("} __attribute__((packed)) token_t;", file=output) print_c("#endif", file=output) print_c("", file=output) print_c("#ifdef GRAMMAR_TABLE", file=output) print_c("#undef GRAMMAR_TABLE", file=output) prod_map = {}; # Compute total size of production table to know what padding we'll need prod_handled = {} total_tokens = 0; for key in parse_table: if len(parse_table[key]) == 0: continue prod = parse_table[key] + (key[1],) if prod not in prod_handled: total_tokens += 2 + len(prod) prod_handled[prod] = True prod_shift = 0 while 1 << (8 + prod_shift) < total_tokens: prod_shift += 1 prod_round = 1 << prod_shift print_c("#ifndef PARSE_TABLE_DECLARATION", file=output) print_c("#define PARSE_TABLE_DECLARATION(n) n", file=output) print_c("#endif", file=output) # # Dump production table. # # This table contains all of the productions in the grammar. # When the top of the parse stack is a non-terminal, the # production matching that non-terminal and the current input # token replaces the top of the parse stack. # # Each production is stored in reverse order so that the # tokens can be simply pushed in order. The productions are # terminated with TOKEN_NONE, and then padded to a multiple # of a power of two tokens so that the index into this # table can be stored in a single byte. # print_c("/*", file=output); print_c(" * Parse table", file=output); print_c(" *", file=output); for key in parse_table: terminal = key[0] non_terminal = key[1] print_c(" * %-12s, %-12s" % (terminal, non_terminal), end='', file=output) prod = parse_table[key] if not prod: print_c("()", end='', file=output) for token in prod: name = token if is_action(token): name = action_name(token_value, token) print_c(" %s," % name, end='', file=output) print_c("", file=output) print_c(" */", file=output) print_c("static const token_t PARSE_TABLE_DECLARATION(production_table)[] = {", file=output); prod_index = 0 for key in parse_table: prod = parse_table[key] + (key[1],) if prod not in prod_map: prod_map[prod] = prod_index print_c(" /* %4d */ " % prod_index, end='', file=output) for token in prod[::-1]: print_c(" %s," % token_name(token_value, token), end='', file=output) prod_index += 1 # Pad the production with TOKEN_NONE to # allow a single byte to index this table # p = pad(prod_index + 1, prod_round) for i in range(0,p): print_c(" TOKEN_NONE,", end='', file=output) prod_index += 1 print_c(" TOKEN_NONE,", file=output) prod_index += 1 print_c("};", file=output) if num_non_terminals < 255 and num_terminals < 255: token_key_type = "uint8_t" else: token_key_type = "uint16_t" print_c("typedef %s token_key_t;" % token_key_type, file=output) print_c("#define production_index(i) ((i) << %d)" % prod_shift, file=output) best_binding, best_table = optimize(grammar, parse_table, terminals, non_terminals, output) best_len = non_terminal_size(best_table) best_shift = 0 while ((256 - 2) << best_shift) < best_len: best_shift += 1 best_round = 1 << best_shift print_c("#define non_terminal_index(i) ((i) << %d)" % best_shift, file=output) print_c("static const uint8_t PARSE_TABLE_DECLARATION(non_terminal_table)[] = {", file=output) # # Dump the table mapping non-terminals to productions # # This table is indexed by the terminal table so that # the entries need not include the terminal value as well # best_indices = {} best_index = 0 for terms, prods in best_table.items(): best_indices[terms] = best_index # Add a comment marking the start of the table # entries for this terminal set print_c(" /* %d: (%s) */" % (best_index, terminal_names(terms)), file=output) # Dump out production table indices # for prod_ent in prods: non_terminal, prod = prod_ent key = prod + (non_terminal,) print_c(" %3d, /* %18s:" % (prod_map[key] >> prod_shift, non_terminal), end='', file=output) for t in prod: name = t if is_action(t): name = action_name(token_value, t) print_c(" %s" % name, end='', file=output) print_c(" */", file=output) best_index += 1 if terms in best_binding: next_terms = best_binding[terms] print_c(" 0xfe, %3d, /* %s */" % (best_indices[next_terms] >> best_shift, terminal_names(next_terms)), file=output) best_index += 2 else: print_c(" 0xff,", file=output) best_index += 1 p = pad(best_index, best_round) for i in range(p): print_c(" 0xff,", file=output) best_index += 1 print_c("", file=output) print_c("};", file=output) print_c("#define NON_TERMINAL_SIZE %d" % best_index, file=output) # # Dump the table mapping each terminal to a set of # non-terminal/production bindings # # This table holds indices into the non-terminal table cooresponding # to each terminal. # print_c("static const uint8_t PARSE_TABLE_DECLARATION(terminal_table)[] = {", file=output) for terminal in terminals: terms = (terminal,) if terms in best_indices: print_c(" [%s] = %d," % (terminal_name(terminal), best_indices[terms] >> best_shift), file=output) print_c(" [TOKEN_NONE] = %d," % (best_index >> best_shift), file=output) print_c("};", file=output); print_c("#endif /* GRAMMAR_TABLE */", file=output) print_c("", file=output) # # Dump a table of token names. # # This is not usually included in the resulting program, # but can be useful for debugging # print_c("#ifdef TOKEN_NAMES", file=output) print_c("#undef TOKEN_NAMES", file=output) print_c("#define token_name(a) token_names[a]", file=output); print_c("static const char *const token_names[] = {", file=output) print_c(' 0,', file=output); for terminal in terminals: print_c(' "%s",' % (terminal), file=output) for non_terminal in non_terminals: print_c(' "%s",' % (non_terminal), file=output) print_c("};", file=output) print_c("#endif /* TOKEN_NAMES */", file=output) print_c("", file=output) # # Dump the parsing code # # This is the parse_code from above with # all of the actions included at the right spot # print_c("#ifdef PARSE_CODE", file=output) print_c("#undef PARSE_CODE", file=output) actions_loc = parse_code.find(actions_marker) first_bit = parse_code[:actions_loc] last_bit = parse_code[actions_loc + len(actions_marker):] print_c("%s" % first_bit, end='', file=output) for action in actions: print_c(" case %s:" % action_name(token_value, action), file=output) print_c('#line %d "%s"' % (action_line(action), lex_file_name), file=output) print_c(" %s; break;" % action_value(action), file=output) print_c('#line %d "%s"' % (c_line + 1, filename), file=output) print_c("%s" % last_bit, end='', file=output) print_c("#endif /* PARSE_CODE */", file=output) def main(): global lex_file global lex_file_name parser = argparse.ArgumentParser() parser.add_argument("input", help="Grammar input file") parser.add_argument("-o", "--output", help="Parser data output file") parser.add_argument("-f", "--format", help="Parser output format (c, python)") parser.add_argument("-D", "--define", action='append', help="Define pre-processor symbol") args = parser.parse_args() if args.define: for name in args.define: define_pp(name) lex_file = open(args.input, 'r') lex_file_name = args.input output = sys.stdout outputname = "" format = 'c' if not args.format or args.format == 'c': format='c' elif args.format == 'python': format='python' else: error("Invalid output format %r" % args.format) grammar = lola() parse_table = ll(grammar) if args.output: outputname = args.output output = open(args.output, 'w') if format == 'c': dump_c(grammar, parse_table, file=output, filename=outputname) elif format == 'python': dump_python(grammar, parse_table, file=output) main() lola-1.6/pycalc.py000066400000000000000000000075521414126705100141460ustar00rootroot00000000000000#!/usr/bin/env python3 # # Copyright © 2019 Keith Packard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # import sys lex_c = False def getc(): global lex_c if lex_c: c = lex_c lex_c = False else: c = sys.stdin.read(1) return c def ungetc(c): global lex_c lex_c = c lex_value = False def lex(): global lex_value while True: c = getc() if c == '': return 'END' if c == '+': return "PLUS" if c == '-': return "MINUS" if c == '*': return "TIMES" if c == '/': return "DIVIDE" if c == '(': return "OP" if c == ')': return "CP" if c == '\n': return "NL" if '0' <= c and c <= '9': v = ord(c) - ord('0') while True: c = getc() if '0' <= c and c <= '9': v = v * 10 + ord(c) - ord('0') else: ungetc(c) break; lex_value = v return "NUMBER" value_stack = () def head(s): return s[0] def rest(s): return s[1:] def push(v): global value_stack value_stack = (v,) + value_stack def pop(): global value_stack v = head(value_stack) value_stack = rest(value_stack) return v # # lines : line lines # | # # expr : term PLUS expr # | term MINUS expr # | term # # expr : term expr-p # expr-p: PLUS expr # | MINUS expr # | from pycalc_gram import * def is_non_terminal(item): return item[0].islower() def is_terminal(item): return item[0].isupper() def is_action(item): return item[0] == '@' def error(msg): print(msg) exit(1) def test(): global lex_value global value_stack global parse_table table = parse_table stack = ('start',) token = False while True: if stack: top = head(stack) stack = rest(stack) else: top = False if top and is_action(top): if top == "@PUSH": push(lex_value) elif top == "@ADD": push(pop() + pop()) elif top == "@SUBTRACT": a = pop() b = pop() push(b - a) elif top == "@TIMES": push(pop() * pop()) elif top == "@DIVIDE": a = pop() b = pop() push(b / a) elif top == "@NEGATE": a = pop() push(-a) elif top == "@PRINT": print("= %r" % pop()) continue if not token: token = lex() if not top: if token == 'END': return error("parse stack empty at %r" % token) if is_terminal(top): if top == token: token = False else: error("parse error. got %r expected %r" % (token, top)) else: key = (token, top) if key not in table: error("parse error at %r %r" % (token, top)) stack = table[key] + stack test() lola-1.6/pycalc_gram.ll000066400000000000000000000020521414126705100151210ustar00rootroot00000000000000# # Copyright © 2019 Keith Packard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # start : line start | ; line : expr @PRINT@ NL | NL ; expr : term expr-p ; expr-p : PLUS term @ADD@ expr-p | MINUS term @SUBTRACT@ expr-p | ; term : fact term-p ; term-p : TIMES fact @TIMES@ term-p | DIVIDE fact @DIVIDE@ term-p | ; fact : OP expr CP | MINUS fact @NEGATE@ | NUMBER @PUSH@ ; lola-1.6/test/000077500000000000000000000000001414126705100132675ustar00rootroot00000000000000lola-1.6/test/badgram000066400000000000000000000003121414126705100146030ustar00rootroot00000000000000; ; this grammar is left recursive through the null production ; in bar -- it should elicit the error ; ; lola: left-recursive grammar for symbol foo ; ( (foo (bar foo) ) (bar (A B) () ) ) lola-1.6/test/calc.l,v000066400000000000000000000105351414126705100146140ustar00rootroot00000000000000head 1.1; access; symbols; locks keithp:1.1; strict; comment @ * @; 1.1 date 94.12.13.17.40.05; author keithp; state Exp; branches; next ; desc @@ 1.1 log @Initial revision @ text @#!/usr/local/klisp ; ; calc - lisp 4 function calculator ; ; ; data abstraction ; ; a non terminal is a symbol bound to a list of lists ; a terminal is a symbol not bound to a list ; an action is a string ; (defun non-terminalp (item) (and (symbolp item) (boundp item) (listp (eval item)) ) ) (defun terminalp (item) (or (null item) (and (symbolp item) (not (non-terminalp item)) ) ) ) (defun actionp (item) (stringp item) ) (defun null-production (p) (if (null p) t elseif (stringp (car p)) (null-production (cdr p)) else nil ) ) (defun start-symbolp (item) (equal item start-symbol)) (defun parser (parse-table start-symbol end-token) (let ((stack (list start-symbol end-token)) (input-token (lex)) (table-entry) (tos) ) (while stack ; (patom "stack is ") ; (print stack) (setq tos (car stack)) (setq stack (cdr stack)) (if (non-terminalp tos) (setq table-entry (dictionary-lookup parse-table (list input-token tos)) ) (if (null table-entry) (error (strcat "parser: error on " (sprint input-token))) ) ; (patom " pushing production ") (print (cadr table-entry)) (terpr) (cond ((cadr table-entry) (setq stack (conc (cadr table-entry) stack)) ) ) elseif (actionp tos) ; (patom "token is ") (print input-token) ; (patom " performing action ") (print tos) (terpr) (action tos input-token) elseif (terminalp tos) (if (= tos input-token) ; (patom " matching token ") (print tos) (terpr) (if (not (= tos end-token)) (setq input-token (lex)) ) else (error (strcat "parser error on " (sprint input-token))) ) ) ) ) ) (defun lex () (let ((char (getchar))) (cond ((or (= char ~ ) (= char ~\t ) ) (lex) ) ((or (= char nil) (= char -1) ) (symbol "$" parse-dictionary) ) (t (symbol (scons char nil) parse-dictionary) ) ) ) ) (setq value-stack nil) (defun pop-stack () (let ((t (car value-stack))) (setq value-stack (cdr value-stack)) t) ) (defun push-stack (t) (setq value-stack (cons t value-stack)) t ) (setq value-temp 0) (defun action (name value) (let ((t1) (t2)) (cond ((= "ADD" name) (push-stack (+ (pop-stack) (pop-stack))) ) ((= "SUBTRACT" name) (setq t1 (pop-stack)) (setq t2 (pop-stack)) (push-stack (- t2 t1)) ) ((= "MULTIPLY" name) (push-stack (* (pop-stack) (pop-stack))) ) ((= "DIVIDE" name) (setq t1 (pop-stack)) (setq t2 (pop-stack)) (push-stack (/ t2 t1)) ) ((= "PUSH" name) (push-stack value-temp) ) ((= "NEGATE" name) (push-stack (- 0 (pop-stack))) ) ((= "CLEAR" name) (setq value-temp 0) ) ((= "ADD-DIGIT" name) (setq value-temp (+ (* value-temp 10) (- (scar (get-name value)) ~0) ) ) ) ((= "PRINT" name) (print (pop-stack)) (terpr) ) ) ) ) (defun init () (setq parse-table (new-dictionary)) (setq parse-dictionary (new-dictionary)) (setq end-token (symbol "$" parse-dictionary)) ) (defun cadaar (l) (car (cdr (car (car l))))) (defun bind-to-lists (atoms) (cond (atoms (set (car atoms) '(foo)) (bind-to-lists (cdr atoms))) (t nil) ) ) (defun put-lists-into-parse-table (lists parse-table) (cond (lists (dictionary-insert parse-table (caar lists) (car lists)) (put-lists-into-parse-table (cdr lists) parse-table) ) (t nil) ) ) (defun setup-calc (file-in) (init) (setq terminals (fread-dictionary file-in parse-dictionary)) (setq non-terminals (fread-dictionary file-in parse-dictionary)) (setq table (fread-dictionary file-in parse-dictionary)) (bind-to-lists non-terminals) (setq start-symbol (cadaar table)) (put-lists-into-parse-table table parse-table) ) (defun calc () (cond ((not (boundp 'start-symbol)) (let ((file-in (fopen (strcat klisp-lib "/calc.parsetable") 'r))) (setup-calc file-in) (fclose file-in) ) ) ) (parser parse-table (cadaar table) end-token) ) @ lola-1.6/test/calc.parsetable000066400000000000000000000067411414126705100162450ustar00rootroot00000000000000($ |(| |)| |\n| - + / * |0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) (lines expr exprp term termp fact int digits more-digits digit) ( ((+ lines) (expr "PRINT" |\n| lines)) ((- lines) (expr "PRINT" |\n| lines)) ((|9| lines) (expr "PRINT" |\n| lines)) ((|8| lines) (expr "PRINT" |\n| lines)) ((|7| lines) (expr "PRINT" |\n| lines)) ((|6| lines) (expr "PRINT" |\n| lines)) ((|5| lines) (expr "PRINT" |\n| lines)) ((|4| lines) (expr "PRINT" |\n| lines)) ((|3| lines) (expr "PRINT" |\n| lines)) ((|2| lines) (expr "PRINT" |\n| lines)) ((|1| lines) (expr "PRINT" |\n| lines)) ((|0| lines) (expr "PRINT" |\n| lines)) ((|(| lines) (expr "PRINT" |\n| lines)) ((|\n| lines) (|\n| lines)) (($ lines) ()) ((+ expr) (term exprp)) ((- expr) (term exprp)) ((|9| expr) (term exprp)) ((|8| expr) (term exprp)) ((|7| expr) (term exprp)) ((|6| expr) (term exprp)) ((|5| expr) (term exprp)) ((|4| expr) (term exprp)) ((|3| expr) (term exprp)) ((|2| expr) (term exprp)) ((|1| expr) (term exprp)) ((|0| expr) (term exprp)) ((|(| expr) (term exprp)) ((+ exprp) (+ term "ADD" exprp)) ((- exprp) (- term "SUBTRACT" exprp)) ((|)| exprp) ()) ((|\n| exprp) ()) ((+ term) (fact termp)) ((- term) (fact termp)) ((|9| term) (fact termp)) ((|8| term) (fact termp)) ((|7| term) (fact termp)) ((|6| term) (fact termp)) ((|5| term) (fact termp)) ((|4| term) (fact termp)) ((|3| term) (fact termp)) ((|2| term) (fact termp)) ((|1| term) (fact termp)) ((|0| term) (fact termp)) ((|(| term) (fact termp)) ((* termp) (* fact "MULTIPLY" termp)) ((/ termp) (/ fact "DIVIDE" termp)) ((|)| termp) ()) ((|\n| termp) ()) ((- termp) ()) ((+ termp) ()) ((|(| fact) (|(| expr |)|)) ((|9| fact) (int "PUSH")) ((|8| fact) (int "PUSH")) ((|7| fact) (int "PUSH")) ((|6| fact) (int "PUSH")) ((|5| fact) (int "PUSH")) ((|4| fact) (int "PUSH")) ((|3| fact) (int "PUSH")) ((|2| fact) (int "PUSH")) ((|1| fact) (int "PUSH")) ((|0| fact) (int "PUSH")) ((- fact) (- fact "NEGATE")) ((+ fact) (+ fact)) ((|9| int) ("CLEAR" digits)) ((|8| int) ("CLEAR" digits)) ((|7| int) ("CLEAR" digits)) ((|6| int) ("CLEAR" digits)) ((|5| int) ("CLEAR" digits)) ((|4| int) ("CLEAR" digits)) ((|3| int) ("CLEAR" digits)) ((|2| int) ("CLEAR" digits)) ((|1| int) ("CLEAR" digits)) ((|0| int) ("CLEAR" digits)) ((|9| digits) ("ADD-DIGIT" digit more-digits)) ((|8| digits) ("ADD-DIGIT" digit more-digits)) ((|7| digits) ("ADD-DIGIT" digit more-digits)) ((|6| digits) ("ADD-DIGIT" digit more-digits)) ((|5| digits) ("ADD-DIGIT" digit more-digits)) ((|4| digits) ("ADD-DIGIT" digit more-digits)) ((|3| digits) ("ADD-DIGIT" digit more-digits)) ((|2| digits) ("ADD-DIGIT" digit more-digits)) ((|1| digits) ("ADD-DIGIT" digit more-digits)) ((|0| digits) ("ADD-DIGIT" digit more-digits)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|)| more-digits) ()) ((|\n| more-digits) ()) ((- more-digits) ()) ((+ more-digits) ()) ((/ more-digits) ()) ((* more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ) lola-1.6/test/digits000066400000000000000000000003461414126705100145000ustar00rootroot00000000000000; ; this is the simplest case of a ; grammar which elicits the recursive ; follow-set warning. This must be ; run through flo before lola to ; factor out the common left sub- ; expression ; ( (digits (digit digits) (digit) ) ) lola-1.6/test/dtest000066400000000000000000000004431414126705100143360ustar00rootroot00000000000000; ; this is the simplest case of a ; grammar which elicits the recursive ; follow-set warning. This must be ; run through flo before lola to ; factor out the common left sub- ; expression ; ( (digits (digit digits) (digit) ) (digit (|0|)(|1|)(|2|)(|3|)(|4|)(|5|)(|6|)(|7|)(|8|)(|9|) ) ) lola-1.6/test/dtest.t000066400000000000000000000015201414126705100145750ustar00rootroot00000000000000(|9| |8| |7| |6| |5| |4| |3| |2| |1| |0| $) (digits digit digitsp) ( ((|9| digits) (digit digitsp)) ((|8| digits) (digit digitsp)) ((|7| digits) (digit digitsp)) ((|6| digits) (digit digitsp)) ((|5| digits) (digit digitsp)) ((|4| digits) (digit digitsp)) ((|3| digits) (digit digitsp)) ((|2| digits) (digit digitsp)) ((|1| digits) (digit digitsp)) ((|0| digits) (digit digitsp)) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ((|9| digitsp) (digits)) ((|8| digitsp) (digits)) ((|7| digitsp) (digits)) ((|6| digitsp) (digits)) ((|5| digitsp) (digits)) ((|4| digitsp) (digits)) ((|3| digitsp) (digits)) ((|2| digitsp) (digits)) ((|1| digitsp) (digits)) ((|0| digitsp) (digits)) (($ digitsp) ()) ) lola-1.6/test/float000066400000000000000000000015101414126705100143140ustar00rootroot00000000000000; ; this grammar recognises floating point ; expressions involving +,-,*,/ and unary - ; ( (expr (term exprp) ) (exprp (+ term "ADD" exprp) (- term "SUBTRACT" exprp) () ) (term (fact termp) ) (termp (* fact "MULTIPLY" termp) (/ fact "DIVIDE" termp) () ) (fact (|(| expr |)|) (float "PUSH") (- fact "NEGATE") ) (float (opt-sign . "CLEAR" "POINT" digits opt-exp) (opt-sign "CLEAR" digits opt-. opt-exp) ) (opt-sign ("POSITIVE" +) ("NEGATIVE" -) () ) (opt-digits (digits) () ) (digits ("ADD-DIGIT" digit more-digits) ("ADD-DIGIT" digit) ) (more-digits ("ADD-DIGIT" digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) (opt-exp ("EXP" exp) () ) (exp (eE opt-sign "CLEAR" digits) ) (eE (e) (E) ) (opt-. (. "POINT" opt-digits) () ) ) lola-1.6/test/float.g000066400000000000000000000130351414126705100145460ustar00rootroot00000000000000(|(| |9| |8| |7| |6| |5| |4| |3| |2| |1| |0| |)| $ - + / * E e .) (expr exprp term termp fact float opt-sign opt-digits digits more-digits digit opt-exp exp eE opt-. floatp digitsp) ( ((- expr) (term exprp)) ((|9| expr) (term exprp)) ((|8| expr) (term exprp)) ((|7| expr) (term exprp)) ((|6| expr) (term exprp)) ((|5| expr) (term exprp)) ((|4| expr) (term exprp)) ((|3| expr) (term exprp)) ((|2| expr) (term exprp)) ((|1| expr) (term exprp)) ((|0| expr) (term exprp)) ((. expr) (term exprp)) ((+ expr) (term exprp)) ((|(| expr) (term exprp)) ((+ exprp) (+ term "ADD" exprp)) ((- exprp) (- term "SUBTRACT" exprp)) ((|)| exprp) ()) (($ exprp) ()) ((- term) (fact termp)) ((|9| term) (fact termp)) ((|8| term) (fact termp)) ((|7| term) (fact termp)) ((|6| term) (fact termp)) ((|5| term) (fact termp)) ((|4| term) (fact termp)) ((|3| term) (fact termp)) ((|2| term) (fact termp)) ((|1| term) (fact termp)) ((|0| term) (fact termp)) ((. term) (fact termp)) ((+ term) (fact termp)) ((|(| term) (fact termp)) ((* termp) (* fact "MULTIPLY" termp)) ((/ termp) (/ fact "DIVIDE" termp)) ((|)| termp) ()) (($ termp) ()) ((- termp) ()) ((+ termp) ()) ((|(| fact) (|(| expr |)|)) ((|9| fact) (float "PUSH")) ((|8| fact) (float "PUSH")) ((|7| fact) (float "PUSH")) ((|6| fact) (float "PUSH")) ((|5| fact) (float "PUSH")) ((|4| fact) (float "PUSH")) ((|3| fact) (float "PUSH")) ((|2| fact) (float "PUSH")) ((|1| fact) (float "PUSH")) ((|0| fact) (float "PUSH")) ((. fact) (float "PUSH")) ((- fact) (float "PUSH")) ((+ fact) (float "PUSH")) ((- fact) (- fact "NEGATE")) ((|9| float) (opt-sign floatp)) ((|8| float) (opt-sign floatp)) ((|7| float) (opt-sign floatp)) ((|6| float) (opt-sign floatp)) ((|5| float) (opt-sign floatp)) ((|4| float) (opt-sign floatp)) ((|3| float) (opt-sign floatp)) ((|2| float) (opt-sign floatp)) ((|1| float) (opt-sign floatp)) ((|0| float) (opt-sign floatp)) ((. float) (opt-sign floatp)) ((- float) (opt-sign floatp)) ((+ float) (opt-sign floatp)) ((+ opt-sign) ("POSITIVE" +)) ((- opt-sign) ("NEGATIVE" -)) ((|9| opt-sign) ()) ((|8| opt-sign) ()) ((|7| opt-sign) ()) ((|6| opt-sign) ()) ((|5| opt-sign) ()) ((|4| opt-sign) ()) ((|3| opt-sign) ()) ((|2| opt-sign) ()) ((|1| opt-sign) ()) ((|0| opt-sign) ()) ((. opt-sign) ()) ((|9| opt-digits) (digits)) ((|8| opt-digits) (digits)) ((|7| opt-digits) (digits)) ((|6| opt-digits) (digits)) ((|5| opt-digits) (digits)) ((|4| opt-digits) (digits)) ((|3| opt-digits) (digits)) ((|2| opt-digits) (digits)) ((|1| opt-digits) (digits)) ((|0| opt-digits) (digits)) ((|)| opt-digits) ()) (($ opt-digits) ()) ((- opt-digits) ()) ((+ opt-digits) ()) ((/ opt-digits) ()) ((* opt-digits) ()) ((E opt-digits) ()) ((e opt-digits) ()) ((|9| digits) ("ADD-DIGIT" digit digitsp)) ((|8| digits) ("ADD-DIGIT" digit digitsp)) ((|7| digits) ("ADD-DIGIT" digit digitsp)) ((|6| digits) ("ADD-DIGIT" digit digitsp)) ((|5| digits) ("ADD-DIGIT" digit digitsp)) ((|4| digits) ("ADD-DIGIT" digit digitsp)) ((|3| digits) ("ADD-DIGIT" digit digitsp)) ((|2| digits) ("ADD-DIGIT" digit digitsp)) ((|1| digits) ("ADD-DIGIT" digit digitsp)) ((|0| digits) ("ADD-DIGIT" digit digitsp)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|)| more-digits) ()) (($ more-digits) ()) ((- more-digits) ()) ((+ more-digits) ()) ((/ more-digits) ()) ((* more-digits) ()) ((E more-digits) ()) ((e more-digits) ()) ((. more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ((E opt-exp) ("EXP" exp)) ((e opt-exp) ("EXP" exp)) ((|)| opt-exp) ()) (($ opt-exp) ()) ((- opt-exp) ()) ((+ opt-exp) ()) ((/ opt-exp) ()) ((* opt-exp) ()) ((E exp) (eE opt-sign "CLEAR" digits)) ((e exp) (eE opt-sign "CLEAR" digits)) ((e eE) (e)) ((E eE) (E)) ((. opt-.) (. "POINT" opt-digits)) ((|)| opt-.) ()) (($ opt-.) ()) ((- opt-.) ()) ((+ opt-.) ()) ((/ opt-.) ()) ((* opt-.) ()) ((E opt-.) ()) ((e opt-.) ()) ((. floatp) (. "CLEAR" "POINT" digits opt-exp)) ((|9| floatp) ("CLEAR" digits opt-. opt-exp)) ((|8| floatp) ("CLEAR" digits opt-. opt-exp)) ((|7| floatp) ("CLEAR" digits opt-. opt-exp)) ((|6| floatp) ("CLEAR" digits opt-. opt-exp)) ((|5| floatp) ("CLEAR" digits opt-. opt-exp)) ((|4| floatp) ("CLEAR" digits opt-. opt-exp)) ((|3| floatp) ("CLEAR" digits opt-. opt-exp)) ((|2| floatp) ("CLEAR" digits opt-. opt-exp)) ((|1| floatp) ("CLEAR" digits opt-. opt-exp)) ((|0| floatp) ("CLEAR" digits opt-. opt-exp)) ((|)| digitsp) (more-digits)) (($ digitsp) (more-digits)) ((- digitsp) (more-digits)) ((+ digitsp) (more-digits)) ((/ digitsp) (more-digits)) ((* digitsp) (more-digits)) ((E digitsp) (more-digits)) ((e digitsp) (more-digits)) ((. digitsp) (more-digits)) ((|9| digitsp) (more-digits)) ((|8| digitsp) (more-digits)) ((|7| digitsp) (more-digits)) ((|6| digitsp) (more-digits)) ((|5| digitsp) (more-digits)) ((|4| digitsp) (more-digits)) ((|3| digitsp) (more-digits)) ((|2| digitsp) (more-digits)) ((|1| digitsp) (more-digits)) ((|0| digitsp) (more-digits)) ((|)| digitsp) ()) (($ digitsp) ()) ((- digitsp) ()) ((+ digitsp) ()) ((/ digitsp) ()) ((* digitsp) ()) ((E digitsp) ()) ((e digitsp) ()) ((. digitsp) ()) ) lola-1.6/test/foofram000066400000000000000000000067411414126705100146530ustar00rootroot00000000000000($ |(| |)| |\n| - + / * |0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) (lines expr exprp term termp fact int digits more-digits digit) ( ((+ lines) (expr "PRINT" |\n| lines)) ((- lines) (expr "PRINT" |\n| lines)) ((|9| lines) (expr "PRINT" |\n| lines)) ((|8| lines) (expr "PRINT" |\n| lines)) ((|7| lines) (expr "PRINT" |\n| lines)) ((|6| lines) (expr "PRINT" |\n| lines)) ((|5| lines) (expr "PRINT" |\n| lines)) ((|4| lines) (expr "PRINT" |\n| lines)) ((|3| lines) (expr "PRINT" |\n| lines)) ((|2| lines) (expr "PRINT" |\n| lines)) ((|1| lines) (expr "PRINT" |\n| lines)) ((|0| lines) (expr "PRINT" |\n| lines)) ((|(| lines) (expr "PRINT" |\n| lines)) ((|\n| lines) (|\n| lines)) (($ lines) ()) ((+ expr) (term exprp)) ((- expr) (term exprp)) ((|9| expr) (term exprp)) ((|8| expr) (term exprp)) ((|7| expr) (term exprp)) ((|6| expr) (term exprp)) ((|5| expr) (term exprp)) ((|4| expr) (term exprp)) ((|3| expr) (term exprp)) ((|2| expr) (term exprp)) ((|1| expr) (term exprp)) ((|0| expr) (term exprp)) ((|(| expr) (term exprp)) ((+ exprp) (+ term "ADD" exprp)) ((- exprp) (- term "SUBTRACT" exprp)) ((|)| exprp) ()) ((|\n| exprp) ()) ((+ term) (fact termp)) ((- term) (fact termp)) ((|9| term) (fact termp)) ((|8| term) (fact termp)) ((|7| term) (fact termp)) ((|6| term) (fact termp)) ((|5| term) (fact termp)) ((|4| term) (fact termp)) ((|3| term) (fact termp)) ((|2| term) (fact termp)) ((|1| term) (fact termp)) ((|0| term) (fact termp)) ((|(| term) (fact termp)) ((* termp) (* fact "MULTIPLY" termp)) ((/ termp) (/ fact "DIVIDE" termp)) ((|)| termp) ()) ((|\n| termp) ()) ((- termp) ()) ((+ termp) ()) ((|(| fact) (|(| expr |)|)) ((|9| fact) (int "PUSH")) ((|8| fact) (int "PUSH")) ((|7| fact) (int "PUSH")) ((|6| fact) (int "PUSH")) ((|5| fact) (int "PUSH")) ((|4| fact) (int "PUSH")) ((|3| fact) (int "PUSH")) ((|2| fact) (int "PUSH")) ((|1| fact) (int "PUSH")) ((|0| fact) (int "PUSH")) ((- fact) (- fact "NEGATE")) ((+ fact) (+ fact)) ((|9| int) ("CLEAR" digits)) ((|8| int) ("CLEAR" digits)) ((|7| int) ("CLEAR" digits)) ((|6| int) ("CLEAR" digits)) ((|5| int) ("CLEAR" digits)) ((|4| int) ("CLEAR" digits)) ((|3| int) ("CLEAR" digits)) ((|2| int) ("CLEAR" digits)) ((|1| int) ("CLEAR" digits)) ((|0| int) ("CLEAR" digits)) ((|9| digits) ("ADD-DIGIT" digit more-digits)) ((|8| digits) ("ADD-DIGIT" digit more-digits)) ((|7| digits) ("ADD-DIGIT" digit more-digits)) ((|6| digits) ("ADD-DIGIT" digit more-digits)) ((|5| digits) ("ADD-DIGIT" digit more-digits)) ((|4| digits) ("ADD-DIGIT" digit more-digits)) ((|3| digits) ("ADD-DIGIT" digit more-digits)) ((|2| digits) ("ADD-DIGIT" digit more-digits)) ((|1| digits) ("ADD-DIGIT" digit more-digits)) ((|0| digits) ("ADD-DIGIT" digit more-digits)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|)| more-digits) ()) ((|\n| more-digits) ()) ((- more-digits) ()) ((+ more-digits) ()) ((/ more-digits) ()) ((* more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ) lola-1.6/test/grammar000066400000000000000000000003751414126705100146450ustar00rootroot00000000000000((E (T Ep) ) (Ep (+ T "ADD" Ep) (- T "SUBTRACT" Ep) () ) (T (F Tp) ) (Tp (* F "TIMES" Tp) (/ F "DIVIDE" Tp) () ) (F ( |(| E |)| ) (- F "NEGATE") ("PUSH" id) ) ) lola-1.6/test/in000066400000000000000000000014011414126705100136140ustar00rootroot00000000000000( (expr (term exprp) ) (exprp (+ term "ADD" exprp) (- term "SUBTRACT" exprp) () ) (term (fact termp) ) (termp (* fact "MULTIPLY" termp) (/ fact "DIVIDE" termp) () ) (fact (|(| expr |)|) (float "PUSH") (- fact "NEGATE") ) (float (opt-sign floatp) ) (opt-sign ("POSITIVE" +) ("NEGATIVE" -) () ) (opt-digits (digits) () ) (digits ("ADD-DIGIT" digit digitsp) ) (more-digits ("ADD-DIGIT" digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) (opt-exp ("EXP" exp) () ) (exp (eE opt-sign "CLEAR" digits) ) (eE (e) (E) ) (opt-. (. "POINT" opt-digits) () ) (floatp (. "CLEAR" "POINT" digits opt-exp) ("CLEAR" digits opt-. opt-exp) ) (digitsp (more-digits) () ) ) lola-1.6/test/int000066400000000000000000000011211414126705100137770ustar00rootroot00000000000000; ; this grammar recognises integer ; expressions involving +,-,*,/ and unary - ; ( (lines (expr "PRINT" \n lines) (\n lines) () ) (expr (term exprp) ) (exprp (+ term "ADD" exprp) (- term "SUBTRACT" exprp) () ) (term (fact termp) ) (termp (* fact "MULTIPLY" termp) (/ fact "DIVIDE" termp) () ) (fact (|(| expr |)|) (int "PUSH") (- fact "NEGATE") (+ fact) ) (int ("CLEAR" digits) ) (digits ("ADD-DIGIT" digit more-digits) ) (more-digits ("ADD-DIGIT" digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) ) lola-1.6/test/int.f000066400000000000000000000010221414126705100142230ustar00rootroot00000000000000( (lines (expr "PRINT" |\n| lines) () ) (expr (term exprp) ) (exprp (+ term "ADD" exprp) (- term "SUBTRACT" exprp) () ) (term (fact termp) ) (termp (* fact "MULTIPLY" termp) (/ fact "DIVIDE" termp) () ) (fact (|(| expr |)|) (int "PUSH") (- fact "NEGATE") (+ fact) ) (int ("CLEAR" digits) ) (digits ("ADD-DIGIT" digit digitsp) ) (more-digits ("ADD-DIGIT" digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) (digitsp (more-digits) () ) ) lola-1.6/test/int.g000066400000000000000000000067411414126705100142410ustar00rootroot00000000000000($ |(| |)| |\n| - + / * |0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) (lines expr exprp term termp fact int digits more-digits digit) ( ((+ lines) (expr "PRINT" |\n| lines)) ((- lines) (expr "PRINT" |\n| lines)) ((|9| lines) (expr "PRINT" |\n| lines)) ((|8| lines) (expr "PRINT" |\n| lines)) ((|7| lines) (expr "PRINT" |\n| lines)) ((|6| lines) (expr "PRINT" |\n| lines)) ((|5| lines) (expr "PRINT" |\n| lines)) ((|4| lines) (expr "PRINT" |\n| lines)) ((|3| lines) (expr "PRINT" |\n| lines)) ((|2| lines) (expr "PRINT" |\n| lines)) ((|1| lines) (expr "PRINT" |\n| lines)) ((|0| lines) (expr "PRINT" |\n| lines)) ((|(| lines) (expr "PRINT" |\n| lines)) ((|\n| lines) (|\n| lines)) (($ lines) ()) ((+ expr) (term exprp)) ((- expr) (term exprp)) ((|9| expr) (term exprp)) ((|8| expr) (term exprp)) ((|7| expr) (term exprp)) ((|6| expr) (term exprp)) ((|5| expr) (term exprp)) ((|4| expr) (term exprp)) ((|3| expr) (term exprp)) ((|2| expr) (term exprp)) ((|1| expr) (term exprp)) ((|0| expr) (term exprp)) ((|(| expr) (term exprp)) ((+ exprp) (+ term "ADD" exprp)) ((- exprp) (- term "SUBTRACT" exprp)) ((|)| exprp) ()) ((|\n| exprp) ()) ((+ term) (fact termp)) ((- term) (fact termp)) ((|9| term) (fact termp)) ((|8| term) (fact termp)) ((|7| term) (fact termp)) ((|6| term) (fact termp)) ((|5| term) (fact termp)) ((|4| term) (fact termp)) ((|3| term) (fact termp)) ((|2| term) (fact termp)) ((|1| term) (fact termp)) ((|0| term) (fact termp)) ((|(| term) (fact termp)) ((* termp) (* fact "MULTIPLY" termp)) ((/ termp) (/ fact "DIVIDE" termp)) ((|)| termp) ()) ((|\n| termp) ()) ((- termp) ()) ((+ termp) ()) ((|(| fact) (|(| expr |)|)) ((|9| fact) (int "PUSH")) ((|8| fact) (int "PUSH")) ((|7| fact) (int "PUSH")) ((|6| fact) (int "PUSH")) ((|5| fact) (int "PUSH")) ((|4| fact) (int "PUSH")) ((|3| fact) (int "PUSH")) ((|2| fact) (int "PUSH")) ((|1| fact) (int "PUSH")) ((|0| fact) (int "PUSH")) ((- fact) (- fact "NEGATE")) ((+ fact) (+ fact)) ((|9| int) ("CLEAR" digits)) ((|8| int) ("CLEAR" digits)) ((|7| int) ("CLEAR" digits)) ((|6| int) ("CLEAR" digits)) ((|5| int) ("CLEAR" digits)) ((|4| int) ("CLEAR" digits)) ((|3| int) ("CLEAR" digits)) ((|2| int) ("CLEAR" digits)) ((|1| int) ("CLEAR" digits)) ((|0| int) ("CLEAR" digits)) ((|9| digits) ("ADD-DIGIT" digit more-digits)) ((|8| digits) ("ADD-DIGIT" digit more-digits)) ((|7| digits) ("ADD-DIGIT" digit more-digits)) ((|6| digits) ("ADD-DIGIT" digit more-digits)) ((|5| digits) ("ADD-DIGIT" digit more-digits)) ((|4| digits) ("ADD-DIGIT" digit more-digits)) ((|3| digits) ("ADD-DIGIT" digit more-digits)) ((|2| digits) ("ADD-DIGIT" digit more-digits)) ((|1| digits) ("ADD-DIGIT" digit more-digits)) ((|0| digits) ("ADD-DIGIT" digit more-digits)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|)| more-digits) ()) ((|\n| more-digits) ()) ((- more-digits) ()) ((+ more-digits) ()) ((/ more-digits) ()) ((* more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ) lola-1.6/test/int.g2000066400000000000000000000067411414126705100143230ustar00rootroot00000000000000($ |(| |)| |\n| - + / * |0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) (lines expr exprp term termp fact int digits more-digits digit) ( ((+ lines) (expr "PRINT" |\n| lines)) ((- lines) (expr "PRINT" |\n| lines)) ((|9| lines) (expr "PRINT" |\n| lines)) ((|8| lines) (expr "PRINT" |\n| lines)) ((|7| lines) (expr "PRINT" |\n| lines)) ((|6| lines) (expr "PRINT" |\n| lines)) ((|5| lines) (expr "PRINT" |\n| lines)) ((|4| lines) (expr "PRINT" |\n| lines)) ((|3| lines) (expr "PRINT" |\n| lines)) ((|2| lines) (expr "PRINT" |\n| lines)) ((|1| lines) (expr "PRINT" |\n| lines)) ((|0| lines) (expr "PRINT" |\n| lines)) ((|(| lines) (expr "PRINT" |\n| lines)) ((|\n| lines) (|\n| lines)) (($ lines) ()) ((+ expr) (term exprp)) ((- expr) (term exprp)) ((|9| expr) (term exprp)) ((|8| expr) (term exprp)) ((|7| expr) (term exprp)) ((|6| expr) (term exprp)) ((|5| expr) (term exprp)) ((|4| expr) (term exprp)) ((|3| expr) (term exprp)) ((|2| expr) (term exprp)) ((|1| expr) (term exprp)) ((|0| expr) (term exprp)) ((|(| expr) (term exprp)) ((+ exprp) (+ term "ADD" exprp)) ((- exprp) (- term "SUBTRACT" exprp)) ((|)| exprp) ()) ((|\n| exprp) ()) ((+ term) (fact termp)) ((- term) (fact termp)) ((|9| term) (fact termp)) ((|8| term) (fact termp)) ((|7| term) (fact termp)) ((|6| term) (fact termp)) ((|5| term) (fact termp)) ((|4| term) (fact termp)) ((|3| term) (fact termp)) ((|2| term) (fact termp)) ((|1| term) (fact termp)) ((|0| term) (fact termp)) ((|(| term) (fact termp)) ((* termp) (* fact "MULTIPLY" termp)) ((/ termp) (/ fact "DIVIDE" termp)) ((|)| termp) ()) ((|\n| termp) ()) ((- termp) ()) ((+ termp) ()) ((|(| fact) (|(| expr |)|)) ((|9| fact) (int "PUSH")) ((|8| fact) (int "PUSH")) ((|7| fact) (int "PUSH")) ((|6| fact) (int "PUSH")) ((|5| fact) (int "PUSH")) ((|4| fact) (int "PUSH")) ((|3| fact) (int "PUSH")) ((|2| fact) (int "PUSH")) ((|1| fact) (int "PUSH")) ((|0| fact) (int "PUSH")) ((- fact) (- fact "NEGATE")) ((+ fact) (+ fact)) ((|9| int) ("CLEAR" digits)) ((|8| int) ("CLEAR" digits)) ((|7| int) ("CLEAR" digits)) ((|6| int) ("CLEAR" digits)) ((|5| int) ("CLEAR" digits)) ((|4| int) ("CLEAR" digits)) ((|3| int) ("CLEAR" digits)) ((|2| int) ("CLEAR" digits)) ((|1| int) ("CLEAR" digits)) ((|0| int) ("CLEAR" digits)) ((|9| digits) ("ADD-DIGIT" digit more-digits)) ((|8| digits) ("ADD-DIGIT" digit more-digits)) ((|7| digits) ("ADD-DIGIT" digit more-digits)) ((|6| digits) ("ADD-DIGIT" digit more-digits)) ((|5| digits) ("ADD-DIGIT" digit more-digits)) ((|4| digits) ("ADD-DIGIT" digit more-digits)) ((|3| digits) ("ADD-DIGIT" digit more-digits)) ((|2| digits) ("ADD-DIGIT" digit more-digits)) ((|1| digits) ("ADD-DIGIT" digit more-digits)) ((|0| digits) ("ADD-DIGIT" digit more-digits)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|)| more-digits) ()) ((|\n| more-digits) ()) ((- more-digits) ()) ((+ more-digits) ()) ((/ more-digits) ()) ((* more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ) lola-1.6/test/intn000066400000000000000000000007571414126705100141730ustar00rootroot00000000000000; ; this grammar recognises integer ; expressions involving +,-,*,/ and unary - ; ( (lines (expr |\n| lines) () ) (expr (term exprp) ) (exprp (+ term exprp) (- term exprp) () ) (term (fact termp) ) (termp (* fact termp) (/ fact termp) () ) (fact (|(| expr |)|) (int ) (- fact ) (+ fact) ) (int (digits) ) (digits (digit more-digits) ) (more-digits (digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) ) lola-1.6/test/intn.f000066400000000000000000000006651414126705100144150ustar00rootroot00000000000000( (lines (expr |\n| lines) () ) (expr (term exprp) ) (exprp (+ term exprp) (- term exprp) () ) (term (fact termp) ) (termp (* fact termp) (/ fact termp) () ) (fact (|(| expr |)|) (int) (- fact) (+ fact) ) (int (digits) ) (digits (digit digitsp) ) (more-digits (digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) (digitsp (more-digits) () ) ) lola-1.6/test/intn.g000066400000000000000000000113121414126705100144050ustar00rootroot00000000000000non-terminal lines first-set for production (expr |\n| lines): (|(| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| - +) first-set for production nil: (nil) follow-set for production nil: ($) non-terminal expr first-set for production (term exprp): (|(| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| - +) non-terminal exprp first-set for production (+ term exprp): (+) first-set for production (- term exprp): (-) first-set for production nil: (nil) follow-set for production nil: (|\n| |)|) non-terminal term first-set for production (fact termp): (|(| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| - +) non-terminal termp first-set for production (* fact termp): (*) first-set for production (/ fact termp): (/) first-set for production nil: (nil) follow-set for production nil: (+ - |\n| |)|) non-terminal fact first-set for production (|(| expr |)|): (|(|) first-set for production (int): (|0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) first-set for production (- fact): (-) first-set for production (+ fact): (+) non-terminal int first-set for production (digits): (|0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) non-terminal digits first-set for production (digit more-digits): (|0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) non-terminal more-digits first-set for production (digit more-digits): (|0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) first-set for production nil: (nil) follow-set for production nil: (* / + - |\n| |)|) non-terminal digit first-set for production (|0|): (|0|) first-set for production (|1|): (|1|) first-set for production (|2|): (|2|) first-set for production (|3|): (|3|) first-set for production (|4|): (|4|) first-set for production (|5|): (|5|) first-set for production (|6|): (|6|) first-set for production (|7|): (|7|) first-set for production (|8|): (|8|) first-set for production (|9|): (|9|) ($ |(| |)| |\n| - + / * |0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) (lines expr exprp term termp fact int digits more-digits digit) ( ((+ lines) (expr |\n| lines)) ((- lines) (expr |\n| lines)) ((|9| lines) (expr |\n| lines)) ((|8| lines) (expr |\n| lines)) ((|7| lines) (expr |\n| lines)) ((|6| lines) (expr |\n| lines)) ((|5| lines) (expr |\n| lines)) ((|4| lines) (expr |\n| lines)) ((|3| lines) (expr |\n| lines)) ((|2| lines) (expr |\n| lines)) ((|1| lines) (expr |\n| lines)) ((|0| lines) (expr |\n| lines)) ((|(| lines) (expr |\n| lines)) (($ lines) ()) ((+ expr) (term exprp)) ((- expr) (term exprp)) ((|9| expr) (term exprp)) ((|8| expr) (term exprp)) ((|7| expr) (term exprp)) ((|6| expr) (term exprp)) ((|5| expr) (term exprp)) ((|4| expr) (term exprp)) ((|3| expr) (term exprp)) ((|2| expr) (term exprp)) ((|1| expr) (term exprp)) ((|0| expr) (term exprp)) ((|(| expr) (term exprp)) ((+ exprp) (+ term exprp)) ((- exprp) (- term exprp)) ((|)| exprp) ()) ((|\n| exprp) ()) ((+ term) (fact termp)) ((- term) (fact termp)) ((|9| term) (fact termp)) ((|8| term) (fact termp)) ((|7| term) (fact termp)) ((|6| term) (fact termp)) ((|5| term) (fact termp)) ((|4| term) (fact termp)) ((|3| term) (fact termp)) ((|2| term) (fact termp)) ((|1| term) (fact termp)) ((|0| term) (fact termp)) ((|(| term) (fact termp)) ((* termp) (* fact termp)) ((/ termp) (/ fact termp)) ((|)| termp) ()) ((|\n| termp) ()) ((- termp) ()) ((+ termp) ()) ((|(| fact) (|(| expr |)|)) ((|9| fact) (int)) ((|8| fact) (int)) ((|7| fact) (int)) ((|6| fact) (int)) ((|5| fact) (int)) ((|4| fact) (int)) ((|3| fact) (int)) ((|2| fact) (int)) ((|1| fact) (int)) ((|0| fact) (int)) ((- fact) (- fact)) ((+ fact) (+ fact)) ((|9| int) (digits)) ((|8| int) (digits)) ((|7| int) (digits)) ((|6| int) (digits)) ((|5| int) (digits)) ((|4| int) (digits)) ((|3| int) (digits)) ((|2| int) (digits)) ((|1| int) (digits)) ((|0| int) (digits)) ((|9| digits) (digit more-digits)) ((|8| digits) (digit more-digits)) ((|7| digits) (digit more-digits)) ((|6| digits) (digit more-digits)) ((|5| digits) (digit more-digits)) ((|4| digits) (digit more-digits)) ((|3| digits) (digit more-digits)) ((|2| digits) (digit more-digits)) ((|1| digits) (digit more-digits)) ((|0| digits) (digit more-digits)) ((|9| more-digits) (digit more-digits)) ((|8| more-digits) (digit more-digits)) ((|7| more-digits) (digit more-digits)) ((|6| more-digits) (digit more-digits)) ((|5| more-digits) (digit more-digits)) ((|4| more-digits) (digit more-digits)) ((|3| more-digits) (digit more-digits)) ((|2| more-digits) (digit more-digits)) ((|1| more-digits) (digit more-digits)) ((|0| more-digits) (digit more-digits)) ((|)| more-digits) ()) ((|\n| more-digits) ()) ((- more-digits) ()) ((+ more-digits) ()) ((/ more-digits) ()) ((* more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ) lola-1.6/test/intr000066400000000000000000000007641414126705100141750ustar00rootroot00000000000000; ; this grammar recognises integer ; expressions involving +,-,*,/ and unary - ; ( (lines (expr "PRINT" \n lines) (\n lines) () ) (expr (term + term "ADD") (term - term "SUBTRACT") (term) ) (term (fact * fact "MULTIPLY") (fact / fact "DIVIDE") (fact) ) (fact (|(| expr |)|) (int "PUSH") (- fact "NEGATE") ) (int ("CLEAR" "ADD-DIGIT" digit digits) ) (digits ("ADD-DIGIT" digit digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) ) lola-1.6/test/intr-leftfactor000066400000000000000000000010571414126705100163200ustar00rootroot00000000000000; ; this grammar recognises integer ; expressions involving +,-,*,/ and unary - ; ( (lines (expr "PRINT" \n lines) (\n lines) () ) (expr (term + term "ADD") (term - term "SUBTRACT") (term) ) (term (fact * fact "MULTIPLY" termp) (fact / fact "DIVIDE" termp) (fact) ) (fact (|(| expr |)|) (int "PUSH") (- fact "NEGATE") (+ fact) ) (int ("CLEAR" digits) ) (digits ("ADD-DIGIT" digit more-digits) ) (more-digits ("ADD-DIGIT" digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) ) lola-1.6/test/iparser000077500000000000000000000103461414126705100146660ustar00rootroot00000000000000#!/usr/local/calypso ; ; parser - test a parse table ; ; ; data abstraction ; ; a non terminal is a symbol bound to a list of lists ; a terminal is a symbol not bound to a list ; an action is a string ; (defun non-terminalp (item) (and (symbolp item) (boundp item) (listp (eval item)) ) ) (defun terminalp (item) (or (null item) (and (symbolp item) (not (non-terminalp item)) ) ) ) (defun actionp (item) (stringp item) ) (defun null-production (p) (if (null p) t elseif (stringp (car p)) (null-production (cdr p)) else nil ) ) (defun start-symbolp (item) (equal item start-symbol)) (defun parser (parse-table start-symbol end-token) (let ((stack (list start-symbol end-token)) (input-token (lex)) (table-entry) (tos) ) (while stack (patom "stack is ") (print stack) (setq tos (car stack)) (setq stack (cdr stack)) (if (non-terminalp tos) (setq table-entry (dictionary-lookup parse-table (list input-token tos)) ) (if (null table-entry) (error (strcat "parser: error on " (sprint input-token))) ) (patom " pushing production ") (print (cadr table-entry)) (terpr) (cond ((cadr table-entry) (setq stack (conc (cadr table-entry) stack)) ) ) elseif (actionp tos) (patom "token is ") (print input-token) (patom " performing action ") (print tos) (terpr) (action tos input-token) elseif (terminalp tos) (if (= tos input-token) (patom " matching token ") (print tos) (terpr) (if (not (= tos end-token)) (setq input-token (lex)) ) else (error (strcat "parser error on " (sprint input-token))) ) ) ) ) ) (defun lex () (let ((char (getchar))) (cond ((or (= char ~ ) (= char ~\t ) ) (lex) ) ((or (= char nil) (= char -1) ) (symbol "$" parse-dictionary) ) (t (symbol (scons char nil) parse-dictionary) ) ) ) ) (setq value-stack nil) (defun pop-stack () (let ((t (car value-stack))) (setq value-stack (cdr value-stack)) t) ) (defun push-stack (t) (setq value-stack (cons t value-stack)) t ) (setq value-temp 0) (defun action (name value) (let ((t1) (t2)) (cond ((= "ADD" name) (push-stack (+ (pop-stack) (pop-stack))) ) ((= "SUBTRACT" name) (setq t1 (pop-stack)) (setq t2 (pop-stack)) (push-stack (- t2 t1)) ) ((= "MULTIPLY" name) (push-stack (* (pop-stack) (pop-stack))) ) ((= "DIVIDE" name) (setq t1 (pop-stack)) (setq t2 (pop-stack)) (push-stack (/ t2 t1)) ) ((= "PUSH" name) (push-stack value-temp) ) ((= "NEGATE" name) (push-stack (- 0 (pop-stack))) ) ((= "CLEAR" name) (setq value-temp 0) ) ((= "ADD-DIGIT" name) (setq value-temp (+ (* value-temp 10) (- (scar (get-name value)) ~0) ) ) ) ((= "PRINT" name) (print (pop-stack)) (terpr) ) ) ) ) (defun init () (setq parse-table (new-dictionary)) (setq parse-dictionary (new-dictionary)) (setq end-token (symbol "$" parse-dictionary)) ) (defun cadaar (l) (car (cdr (car (car l))))) (defun bind-to-lists (atoms) (cond (atoms (set (car atoms) '(foo)) (bind-to-lists (cdr atoms))) (t nil) ) ) (defun put-lists-into-parse-table (lists parse-table) (cond (lists (dictionary-insert parse-table (caar lists) (car lists)) (put-lists-into-parse-table (cdr lists) parse-table) ) (t nil) ) ) (defun process-file (file-in) (init) (setq terminals (fread-dictionary file-in parse-dictionary)) (setq non-terminals (fread-dictionary file-in parse-dictionary)) (bind-to-lists non-terminals) (setq table (fread-dictionary file-in parse-dictionary)) (setq start-symbol (cadaar table)) (put-lists-into-parse-table table parse-table) (parser parse-table (cadaar table) end-token) ) (defun main-parser () (setq file-in stdin) (if argv (setq file-in (fopen (car argv) 'r)) (if (null file-in) (error (strcat "parser: can't open " (sprint (car argv)))) ) ) (process-file file-in) (fclose file-in) ) (main-parser) lola-1.6/test/lcalc000077500000000000000000000000641414126705100142730ustar00rootroot00000000000000#!/home/keithp/bin/kalypso (include 'calc.l) (calc) lola-1.6/test/leftgrammar000066400000000000000000000002561414126705100155160ustar00rootroot00000000000000; ; this is an ambiguous grammar and must ; be run through flo before lola to factor ; out the common left sub-expressions ; ((foo (a b c) (a b d) (e f g) (e f h i) ) ) lola-1.6/test/lisp.profile000066400000000000000000000000001414126705100156060ustar00rootroot00000000000000lola-1.6/test/nf.g000066400000000000000000000002731414126705100140440ustar00rootroot00000000000000(|(| |9| |8| |7| |6| |5| |4| |3| |2| |1| |0| |)| $ - + / * E e .) (expr exprp term termp fact float opt-sign opt-digits digits more-digits digit opt-exp exp eE opt-. floatp digitsp) ( (((lola-1.6/test/nfg000066400000000000000000000130351414126705100137660ustar00rootroot00000000000000(|(| |9| |8| |7| |6| |5| |4| |3| |2| |1| |0| |)| $ - + / * E e .) (expr exprp term termp fact float opt-sign opt-digits digits more-digits digit opt-exp exp eE opt-. floatp digitsp) ( ((- expr) (term exprp)) ((|9| expr) (term exprp)) ((|8| expr) (term exprp)) ((|7| expr) (term exprp)) ((|6| expr) (term exprp)) ((|5| expr) (term exprp)) ((|4| expr) (term exprp)) ((|3| expr) (term exprp)) ((|2| expr) (term exprp)) ((|1| expr) (term exprp)) ((|0| expr) (term exprp)) ((. expr) (term exprp)) ((+ expr) (term exprp)) ((|(| expr) (term exprp)) ((+ exprp) (+ term "ADD" exprp)) ((- exprp) (- term "SUBTRACT" exprp)) ((|)| exprp) ()) (($ exprp) ()) ((- term) (fact termp)) ((|9| term) (fact termp)) ((|8| term) (fact termp)) ((|7| term) (fact termp)) ((|6| term) (fact termp)) ((|5| term) (fact termp)) ((|4| term) (fact termp)) ((|3| term) (fact termp)) ((|2| term) (fact termp)) ((|1| term) (fact termp)) ((|0| term) (fact termp)) ((. term) (fact termp)) ((+ term) (fact termp)) ((|(| term) (fact termp)) ((* termp) (* fact "MULTIPLY" termp)) ((/ termp) (/ fact "DIVIDE" termp)) ((|)| termp) ()) (($ termp) ()) ((- termp) ()) ((+ termp) ()) ((|(| fact) (|(| expr |)|)) ((|9| fact) (float "PUSH")) ((|8| fact) (float "PUSH")) ((|7| fact) (float "PUSH")) ((|6| fact) (float "PUSH")) ((|5| fact) (float "PUSH")) ((|4| fact) (float "PUSH")) ((|3| fact) (float "PUSH")) ((|2| fact) (float "PUSH")) ((|1| fact) (float "PUSH")) ((|0| fact) (float "PUSH")) ((. fact) (float "PUSH")) ((- fact) (float "PUSH")) ((+ fact) (float "PUSH")) ((- fact) (- fact "NEGATE")) ((|9| float) (opt-sign floatp)) ((|8| float) (opt-sign floatp)) ((|7| float) (opt-sign floatp)) ((|6| float) (opt-sign floatp)) ((|5| float) (opt-sign floatp)) ((|4| float) (opt-sign floatp)) ((|3| float) (opt-sign floatp)) ((|2| float) (opt-sign floatp)) ((|1| float) (opt-sign floatp)) ((|0| float) (opt-sign floatp)) ((. float) (opt-sign floatp)) ((- float) (opt-sign floatp)) ((+ float) (opt-sign floatp)) ((+ opt-sign) ("POSITIVE" +)) ((- opt-sign) ("NEGATIVE" -)) ((|9| opt-sign) ()) ((|8| opt-sign) ()) ((|7| opt-sign) ()) ((|6| opt-sign) ()) ((|5| opt-sign) ()) ((|4| opt-sign) ()) ((|3| opt-sign) ()) ((|2| opt-sign) ()) ((|1| opt-sign) ()) ((|0| opt-sign) ()) ((. opt-sign) ()) ((|9| opt-digits) (digits)) ((|8| opt-digits) (digits)) ((|7| opt-digits) (digits)) ((|6| opt-digits) (digits)) ((|5| opt-digits) (digits)) ((|4| opt-digits) (digits)) ((|3| opt-digits) (digits)) ((|2| opt-digits) (digits)) ((|1| opt-digits) (digits)) ((|0| opt-digits) (digits)) ((|)| opt-digits) ()) (($ opt-digits) ()) ((- opt-digits) ()) ((+ opt-digits) ()) ((/ opt-digits) ()) ((* opt-digits) ()) ((E opt-digits) ()) ((e opt-digits) ()) ((|9| digits) ("ADD-DIGIT" digit digitsp)) ((|8| digits) ("ADD-DIGIT" digit digitsp)) ((|7| digits) ("ADD-DIGIT" digit digitsp)) ((|6| digits) ("ADD-DIGIT" digit digitsp)) ((|5| digits) ("ADD-DIGIT" digit digitsp)) ((|4| digits) ("ADD-DIGIT" digit digitsp)) ((|3| digits) ("ADD-DIGIT" digit digitsp)) ((|2| digits) ("ADD-DIGIT" digit digitsp)) ((|1| digits) ("ADD-DIGIT" digit digitsp)) ((|0| digits) ("ADD-DIGIT" digit digitsp)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|)| more-digits) ()) (($ more-digits) ()) ((- more-digits) ()) ((+ more-digits) ()) ((/ more-digits) ()) ((* more-digits) ()) ((E more-digits) ()) ((e more-digits) ()) ((. more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ((E opt-exp) ("EXP" exp)) ((e opt-exp) ("EXP" exp)) ((|)| opt-exp) ()) (($ opt-exp) ()) ((- opt-exp) ()) ((+ opt-exp) ()) ((/ opt-exp) ()) ((* opt-exp) ()) ((E exp) (eE opt-sign "CLEAR" digits)) ((e exp) (eE opt-sign "CLEAR" digits)) ((e eE) (e)) ((E eE) (E)) ((. opt-.) (. "POINT" opt-digits)) ((|)| opt-.) ()) (($ opt-.) ()) ((- opt-.) ()) ((+ opt-.) ()) ((/ opt-.) ()) ((* opt-.) ()) ((E opt-.) ()) ((e opt-.) ()) ((. floatp) (. "CLEAR" "POINT" digits opt-exp)) ((|9| floatp) ("CLEAR" digits opt-. opt-exp)) ((|8| floatp) ("CLEAR" digits opt-. opt-exp)) ((|7| floatp) ("CLEAR" digits opt-. opt-exp)) ((|6| floatp) ("CLEAR" digits opt-. opt-exp)) ((|5| floatp) ("CLEAR" digits opt-. opt-exp)) ((|4| floatp) ("CLEAR" digits opt-. opt-exp)) ((|3| floatp) ("CLEAR" digits opt-. opt-exp)) ((|2| floatp) ("CLEAR" digits opt-. opt-exp)) ((|1| floatp) ("CLEAR" digits opt-. opt-exp)) ((|0| floatp) ("CLEAR" digits opt-. opt-exp)) ((|)| digitsp) (more-digits)) (($ digitsp) (more-digits)) ((- digitsp) (more-digits)) ((+ digitsp) (more-digits)) ((/ digitsp) (more-digits)) ((* digitsp) (more-digits)) ((E digitsp) (more-digits)) ((e digitsp) (more-digits)) ((. digitsp) (more-digits)) ((|9| digitsp) (more-digits)) ((|8| digitsp) (more-digits)) ((|7| digitsp) (more-digits)) ((|6| digitsp) (more-digits)) ((|5| digitsp) (more-digits)) ((|4| digitsp) (more-digits)) ((|3| digitsp) (more-digits)) ((|2| digitsp) (more-digits)) ((|1| digitsp) (more-digits)) ((|0| digitsp) (more-digits)) ((|)| digitsp) ()) (($ digitsp) ()) ((- digitsp) ()) ((+ digitsp) ()) ((/ digitsp) ()) ((* digitsp) ()) ((E digitsp) ()) ((e digitsp) ()) ((. digitsp) ()) ) lola-1.6/test/nint.g000066400000000000000000000077511414126705100144210ustar00rootroot00000000000000($ |(| |9| |8| |7| |6| |5| |4| |3| |2| |1| |0| |)| |\n| - + / *) (lines expr exprp term termp fact int digits more-digits digit digitsp) ( ((+ lines) (expr "PRINT" |\n| lines)) ((- lines) (expr "PRINT" |\n| lines)) ((|9| lines) (expr "PRINT" |\n| lines)) ((|8| lines) (expr "PRINT" |\n| lines)) ((|7| lines) (expr "PRINT" |\n| lines)) ((|6| lines) (expr "PRINT" |\n| lines)) ((|5| lines) (expr "PRINT" |\n| lines)) ((|4| lines) (expr "PRINT" |\n| lines)) ((|3| lines) (expr "PRINT" |\n| lines)) ((|2| lines) (expr "PRINT" |\n| lines)) ((|1| lines) (expr "PRINT" |\n| lines)) ((|0| lines) (expr "PRINT" |\n| lines)) ((|(| lines) (expr "PRINT" |\n| lines)) (($ lines) ()) ((+ expr) (term exprp)) ((- expr) (term exprp)) ((|9| expr) (term exprp)) ((|8| expr) (term exprp)) ((|7| expr) (term exprp)) ((|6| expr) (term exprp)) ((|5| expr) (term exprp)) ((|4| expr) (term exprp)) ((|3| expr) (term exprp)) ((|2| expr) (term exprp)) ((|1| expr) (term exprp)) ((|0| expr) (term exprp)) ((|(| expr) (term exprp)) ((+ exprp) (+ term "ADD" exprp)) ((- exprp) (- term "SUBTRACT" exprp)) ((|)| exprp) ()) ((|\n| exprp) ()) ((+ term) (fact termp)) ((- term) (fact termp)) ((|9| term) (fact termp)) ((|8| term) (fact termp)) ((|7| term) (fact termp)) ((|6| term) (fact termp)) ((|5| term) (fact termp)) ((|4| term) (fact termp)) ((|3| term) (fact termp)) ((|2| term) (fact termp)) ((|1| term) (fact termp)) ((|0| term) (fact termp)) ((|(| term) (fact termp)) ((* termp) (* fact "MULTIPLY" termp)) ((/ termp) (/ fact "DIVIDE" termp)) ((|)| termp) ()) ((|\n| termp) ()) ((- termp) ()) ((+ termp) ()) ((|(| fact) (|(| expr |)|)) ((|9| fact) (int "PUSH")) ((|8| fact) (int "PUSH")) ((|7| fact) (int "PUSH")) ((|6| fact) (int "PUSH")) ((|5| fact) (int "PUSH")) ((|4| fact) (int "PUSH")) ((|3| fact) (int "PUSH")) ((|2| fact) (int "PUSH")) ((|1| fact) (int "PUSH")) ((|0| fact) (int "PUSH")) ((- fact) (- fact "NEGATE")) ((+ fact) (+ fact)) ((|9| int) ("CLEAR" digits)) ((|8| int) ("CLEAR" digits)) ((|7| int) ("CLEAR" digits)) ((|6| int) ("CLEAR" digits)) ((|5| int) ("CLEAR" digits)) ((|4| int) ("CLEAR" digits)) ((|3| int) ("CLEAR" digits)) ((|2| int) ("CLEAR" digits)) ((|1| int) ("CLEAR" digits)) ((|0| int) ("CLEAR" digits)) ((|9| digits) ("ADD-DIGIT" digit digitsp)) ((|8| digits) ("ADD-DIGIT" digit digitsp)) ((|7| digits) ("ADD-DIGIT" digit digitsp)) ((|6| digits) ("ADD-DIGIT" digit digitsp)) ((|5| digits) ("ADD-DIGIT" digit digitsp)) ((|4| digits) ("ADD-DIGIT" digit digitsp)) ((|3| digits) ("ADD-DIGIT" digit digitsp)) ((|2| digits) ("ADD-DIGIT" digit digitsp)) ((|1| digits) ("ADD-DIGIT" digit digitsp)) ((|0| digits) ("ADD-DIGIT" digit digitsp)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|)| more-digits) ()) ((|\n| more-digits) ()) ((- more-digits) ()) ((+ more-digits) ()) ((/ more-digits) ()) ((* more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ((|)| digitsp) (more-digits)) ((|\n| digitsp) (more-digits)) ((- digitsp) (more-digits)) ((+ digitsp) (more-digits)) ((/ digitsp) (more-digits)) ((* digitsp) (more-digits)) ((|9| digitsp) (more-digits)) ((|8| digitsp) (more-digits)) ((|7| digitsp) (more-digits)) ((|6| digitsp) (more-digits)) ((|5| digitsp) (more-digits)) ((|4| digitsp) (more-digits)) ((|3| digitsp) (more-digits)) ((|2| digitsp) (more-digits)) ((|1| digitsp) (more-digits)) ((|0| digitsp) (more-digits)) ((|)| digitsp) ()) ((|\n| digitsp) ()) ((- digitsp) ()) ((+ digitsp) ()) ((/ digitsp) ()) ((* digitsp) ()) ) lola-1.6/test/paren000066400000000000000000000001251414126705100143150ustar00rootroot00000000000000((S (|(| Sp) () ) (Sp (|)| S) (|(| Sp) ) ) lola-1.6/test/parser,v000077500000000000000000000063451414126705100147630ustar00rootroot00000000000000head 1.1; access; symbols; locks keithp:1.1; strict; comment @# @; 1.1 date 94.12.13.17.49.30; author keithp; state Exp; branches; next ; desc @@ 1.1 log @Initial revision @ text @#!/usr/local/klisp ; ; parser - test a parse table ; ; ; data abstraction ; ; a non terminal is a symbol bound to a list of lists ; a terminal is a symbol not bound to a list ; an action is a string ; (defun non-terminalp (item) (and (symbolp item) (boundp item) (listp (eval item)) ) ) (defun terminalp (item) (or (null item) (and (symbolp item) (not (non-terminalp item)) ) ) ) (defun actionp (item) (stringp item) ) (defun null-production (p) (if (null p) t elseif (stringp (car p)) (null-production (cdr p)) else nil ) ) (defun start-symbolp (item) (equal item start-symbol)) (defun parser (parse-table start-symbol end-token) (patom "starting\n") (let ((stack (list start-symbol end-token)) (input-token (lex)) (table-entry) (tos) ) (while stack ; (patom "stack is ") ; (print stack) (setq tos (car stack)) (setq stack (cdr stack)) (if (non-terminalp tos) (setq table-entry (dictionary-lookup parse-table (list input-token tos)) ) (if (null table-entry) (error (strcat "parser: error on " (sprint input-token))) ) ; (patom " pushing production ") (print (cadr table-entry)) (terpr) (cond ((cadr table-entry) (setq stack (conc (cadr table-entry) stack)) ) ) elseif (actionp tos) (patom "token is ") (print input-token) (patom " performing action ") (print tos) (terpr) elseif (terminalp tos) (if (= tos input-token) (patom " matching token ") (print tos) (terpr) (if (not (= tos end-token)) (setq input-token (lex)) ) else (error (strcat "parser error on " (sprint input-token))) ) ) ) ) ) (defun lex () (let ((char (getchar))) (symbol (scons char nil) parse-dictionary) ) ) (defun init () (setq parse-dictionary (new-dictionary)) (setq parse-table (new-dictionary)) (setq end-token (symbol "$" parse-dictionary)) ) (defun cadaar (l) (car (cdr (car (car l))))) (defun bind-to-lists (atoms) (cond (atoms (set (car atoms) '(foo)) (bind-to-lists (cdr atoms))) (t nil) ) ) (defun put-lists-into-parse-table (lists parse-table) (cond (lists (dictionary-insert parse-table (caar lists) (car lists)) (put-lists-into-parse-table (cdr lists) parse-table) ) (t nil) ) ) (defun process-file (file-in) (init) (setq terminals (fread-dictionary file-in parse-dictionary)) (setq non-terminals (fread-dictionary file-in parse-dictionary)) (bind-to-lists non-terminals) (setq table (fread-dictionary file-in parse-dictionary)) (setq start-symbol (cadaar table)) (put-lists-into-parse-table table parse-table) (parser parse-table (cadaar table) end-token) ) (defun main-parser () (setq file-in stdin) (if argv (setq file-in (fopen (car argv) 'r)) (if (null file-in) (error (strcat "parser: can't open " (sprint (car argv)))) ) ) (process-file file-in) (fclose file-in) ) (main-parser) @ lola-1.6/test/pparen000066400000000000000000000001441414126705100144760ustar00rootroot00000000000000((S (Op Sp) () ) (Sp (Cp E) (Op Sp) () ) (E (Op Ep) () ) (Ep (Cp E) (Op Ep) ) ) lola-1.6/test/pparen.y000066400000000000000000000001751414126705100147510ustar00rootroot00000000000000%token OP CP %% sentence : matched_parens | OP sentence ; matched_parens : OP matched_parens CP matched_parens ; lola-1.6/test/prof000066400000000000000000000027031414126705100141620ustar00rootroot00000000000000; ; this grammer recognises klisp profile output ; ( (profile-file (opt-whites opt-header opt-profiles) ) (opt-header (name name name) () ) (opt-whites (whites) () ) (opt-profiles (profile opt-profiles) () ) (profile (number profile-p) ) (profile-p (callee) (caller) ) (callee (number class name) ) (caller (name) ) ; ; the rest of the grammar is actually the lexer ; (class (|U| whites) (|B| whites) ) (number ("CLEAR" digits "PUSH" whites) ) (name ("START-NAME" letters "END-NAME" whites) ) (digits ("ADD-DIGIT" digit more-digits) ) (more-digits ("ADD-DIGIT" digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) (letters ("ADD-LETTER" letter more-letters) ) (more-letters ("ADD-LETTER" letter more-letters) () ) (whites (white more-whites) ) (more-whites (white more-whites) () ) (white (| |) (|\n|) ) (letter (|!|) (|"|) (|#|) (|%|) (|&|) (|'|) (|(|) (|)|) (|*|) (|+|) (|,|) (|-|) (|.|) (|/|) (|:|) (|;|) (|<|) (|=|) (|>|) (|?|) (|@|) (|A|) (|B|) (|C|) (|D|) (|E|) (|F|) (|G|) (|H|) (|I|) (|J|) (|K|) (|L|) (|M|) (|N|) (|O|) (|P|) (|Q|) (|R|) (|S|) (|T|) (|U|) (|V|) (|W|) (|X|) (|Y|) (|Z|) (|[|) (|\\|) (|]|) (|^|) (|_|) (|`|) (|a|) (|b|) (|c|) (|d|) (|e|) (|f|) (|g|) (|h|) (|i|) (|j|) (|k|) (|l|) (|m|) (|n|) (|o|) (|p|) (|q|) (|r|) (|s|) (|t|) (|u|) (|v|) (|w|) (|x|) (|y|) (|z|) (|{|) (|\||) (|}|) (|~|) (|\177|) ) ) lola-1.6/test/prof.f000066400000000000000000000034631414126705100144120ustar00rootroot00000000000000( (profile-file (opt-header opt-white opt-profiles) ) (opt-profiles (profiles) () ) (profiles (profile profilesp) ) (profile (callee callers) ) (callee (opt-white number whites number whites class whites name) ) (callers (whites caller callers) () ) (caller (number whites name) ) (class (U) (B) ) (number ("CLEAR" digits) ) (digits ("ADD-DIGIT" digit digitsp) ) (more-digits ("ADD-DIGIT" digit more-digits) () ) (digit (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) ) (name (letter name-end) ) (name-end (printable name-end) () ) (opt-white (white opt-white) () ) (whites (white opt-white) ) (white (| |) (|\n|) (|\n|) ) (printable (!) (|"|) (|#|) ($) (%) (&) (|'|) (|(|) (|)|) (*) (+) (,) (-) (.) (/) (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) (:) (|;|) (<) (=) (>) (?) (@) (A) (B) (C) (D) (E) (F) (G) (H) (I) (J) (K) (L) (M) (N) (O) (P) (Q) (R) (S) (T) (U) (V) (W) (X) (Y) (Z) (|[|) (|\\|) (|]|) (^) (_) (`) (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l) (m) (n) (o) (p) (q) (r) (s) (t) (u) (v) (w) (x) (y) (z) (|{|) (|\||) (|}|) (|~|) (\177) ) (letter (!) (|"|) (|#|) ($) (%) (&) (|'|) (|(|) (|)|) (*) (+) (,) (-) (.) (/) (:) (|;|) (<) (=) (>) (?) (@) (A) (B) (C) (D) (E) (F) (G) (H) (I) (J) (K) (L) (M) (N) (O) (P) (Q) (R) (S) (T) (U) (V) (W) (X) (Y) (Z) (|[|) (|\\|) (|]|) (^) (_) (`) (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l) (m) (n) (o) (p) (q) (r) (s) (t) (u) (v) (w) (x) (y) (z) (|{|) (|\||) (|}|) (|~|) (\177) ) (opt-header (opt-white name whites name whites name) ) (profilesp (whites profiles) () ) (digitsp (more-digits) () ) ) lola-1.6/test/prof.g000066400000000000000000001042261414126705100144120ustar00rootroot00000000000000($ |9| |8| |7| |6| |5| |4| |3| |2| |1| |0| | | |\n| ! |"| |#| % & |'| |(| |)| * + , - . / : |;| < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |[| |\\| |]| ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z |{| |\|| |}| |~| \177) (profile-file opt-header opt-whites opt-profiles profile profile-p callee caller class number name digits more-digits digit letters more-letters whites more-whites white letter) ( (($ profile-file) (opt-whites opt-header opt-profiles)) ((|9| profile-file) (opt-whites opt-header opt-profiles)) ((|8| profile-file) (opt-whites opt-header opt-profiles)) ((|7| profile-file) (opt-whites opt-header opt-profiles)) ((|6| profile-file) (opt-whites opt-header opt-profiles)) ((|5| profile-file) (opt-whites opt-header opt-profiles)) ((|4| profile-file) (opt-whites opt-header opt-profiles)) ((|3| profile-file) (opt-whites opt-header opt-profiles)) ((|2| profile-file) (opt-whites opt-header opt-profiles)) ((|1| profile-file) (opt-whites opt-header opt-profiles)) ((|0| profile-file) (opt-whites opt-header opt-profiles)) ((\177 profile-file) (opt-whites opt-header opt-profiles)) ((|~| profile-file) (opt-whites opt-header opt-profiles)) ((|}| profile-file) (opt-whites opt-header opt-profiles)) ((|\|| profile-file) (opt-whites opt-header opt-profiles)) ((|{| profile-file) (opt-whites opt-header opt-profiles)) ((z profile-file) (opt-whites opt-header opt-profiles)) ((y profile-file) (opt-whites opt-header opt-profiles)) ((x profile-file) (opt-whites opt-header opt-profiles)) ((w profile-file) (opt-whites opt-header opt-profiles)) ((v profile-file) (opt-whites opt-header opt-profiles)) ((u profile-file) (opt-whites opt-header opt-profiles)) ((t profile-file) (opt-whites opt-header opt-profiles)) ((s profile-file) (opt-whites opt-header opt-profiles)) ((r profile-file) (opt-whites opt-header opt-profiles)) ((q profile-file) (opt-whites opt-header opt-profiles)) ((p profile-file) (opt-whites opt-header opt-profiles)) ((o profile-file) (opt-whites opt-header opt-profiles)) ((n profile-file) (opt-whites opt-header opt-profiles)) ((m profile-file) (opt-whites opt-header opt-profiles)) ((l profile-file) (opt-whites opt-header opt-profiles)) ((k profile-file) (opt-whites opt-header opt-profiles)) ((j profile-file) (opt-whites opt-header opt-profiles)) ((i profile-file) (opt-whites opt-header opt-profiles)) ((h profile-file) (opt-whites opt-header opt-profiles)) ((g profile-file) (opt-whites opt-header opt-profiles)) ((f profile-file) (opt-whites opt-header opt-profiles)) ((e profile-file) (opt-whites opt-header opt-profiles)) ((d profile-file) (opt-whites opt-header opt-profiles)) ((c profile-file) (opt-whites opt-header opt-profiles)) ((b profile-file) (opt-whites opt-header opt-profiles)) ((a profile-file) (opt-whites opt-header opt-profiles)) ((` profile-file) (opt-whites opt-header opt-profiles)) ((_ profile-file) (opt-whites opt-header opt-profiles)) ((^ profile-file) (opt-whites opt-header opt-profiles)) ((|]| profile-file) (opt-whites opt-header opt-profiles)) ((|\\| profile-file) (opt-whites opt-header opt-profiles)) ((|[| profile-file) (opt-whites opt-header opt-profiles)) ((Z profile-file) (opt-whites opt-header opt-profiles)) ((Y profile-file) (opt-whites opt-header opt-profiles)) ((X profile-file) (opt-whites opt-header opt-profiles)) ((W profile-file) (opt-whites opt-header opt-profiles)) ((V profile-file) (opt-whites opt-header opt-profiles)) ((U profile-file) (opt-whites opt-header opt-profiles)) ((T profile-file) (opt-whites opt-header opt-profiles)) ((S profile-file) (opt-whites opt-header opt-profiles)) ((R profile-file) (opt-whites opt-header opt-profiles)) ((Q profile-file) (opt-whites opt-header opt-profiles)) ((P profile-file) (opt-whites opt-header opt-profiles)) ((O profile-file) (opt-whites opt-header opt-profiles)) ((N profile-file) (opt-whites opt-header opt-profiles)) ((M profile-file) (opt-whites opt-header opt-profiles)) ((L profile-file) (opt-whites opt-header opt-profiles)) ((K profile-file) (opt-whites opt-header opt-profiles)) ((J profile-file) (opt-whites opt-header opt-profiles)) ((I profile-file) (opt-whites opt-header opt-profiles)) ((H profile-file) (opt-whites opt-header opt-profiles)) ((G profile-file) (opt-whites opt-header opt-profiles)) ((F profile-file) (opt-whites opt-header opt-profiles)) ((E profile-file) (opt-whites opt-header opt-profiles)) ((D profile-file) (opt-whites opt-header opt-profiles)) ((C profile-file) (opt-whites opt-header opt-profiles)) ((B profile-file) (opt-whites opt-header opt-profiles)) ((A profile-file) (opt-whites opt-header opt-profiles)) ((@ profile-file) (opt-whites opt-header opt-profiles)) ((? profile-file) (opt-whites opt-header opt-profiles)) ((> profile-file) (opt-whites opt-header opt-profiles)) ((= profile-file) (opt-whites opt-header opt-profiles)) ((< profile-file) (opt-whites opt-header opt-profiles)) ((|;| profile-file) (opt-whites opt-header opt-profiles)) ((: profile-file) (opt-whites opt-header opt-profiles)) ((/ profile-file) (opt-whites opt-header opt-profiles)) ((. profile-file) (opt-whites opt-header opt-profiles)) ((- profile-file) (opt-whites opt-header opt-profiles)) ((, profile-file) (opt-whites opt-header opt-profiles)) ((+ profile-file) (opt-whites opt-header opt-profiles)) ((* profile-file) (opt-whites opt-header opt-profiles)) ((|)| profile-file) (opt-whites opt-header opt-profiles)) ((|(| profile-file) (opt-whites opt-header opt-profiles)) ((|'| profile-file) (opt-whites opt-header opt-profiles)) ((& profile-file) (opt-whites opt-header opt-profiles)) ((% profile-file) (opt-whites opt-header opt-profiles)) ((|#| profile-file) (opt-whites opt-header opt-profiles)) ((|"| profile-file) (opt-whites opt-header opt-profiles)) ((! profile-file) (opt-whites opt-header opt-profiles)) ((|\n| profile-file) (opt-whites opt-header opt-profiles)) ((| | profile-file) (opt-whites opt-header opt-profiles)) ((\177 opt-header) (name name name)) ((|~| opt-header) (name name name)) ((|}| opt-header) (name name name)) ((|\|| opt-header) (name name name)) ((|{| opt-header) (name name name)) ((z opt-header) (name name name)) ((y opt-header) (name name name)) ((x opt-header) (name name name)) ((w opt-header) (name name name)) ((v opt-header) (name name name)) ((u opt-header) (name name name)) ((t opt-header) (name name name)) ((s opt-header) (name name name)) ((r opt-header) (name name name)) ((q opt-header) (name name name)) ((p opt-header) (name name name)) ((o opt-header) (name name name)) ((n opt-header) (name name name)) ((m opt-header) (name name name)) ((l opt-header) (name name name)) ((k opt-header) (name name name)) ((j opt-header) (name name name)) ((i opt-header) (name name name)) ((h opt-header) (name name name)) ((g opt-header) (name name name)) ((f opt-header) (name name name)) ((e opt-header) (name name name)) ((d opt-header) (name name name)) ((c opt-header) (name name name)) ((b opt-header) (name name name)) ((a opt-header) (name name name)) ((` opt-header) (name name name)) ((_ opt-header) (name name name)) ((^ opt-header) (name name name)) ((|]| opt-header) (name name name)) ((|\\| opt-header) (name name name)) ((|[| opt-header) (name name name)) ((Z opt-header) (name name name)) ((Y opt-header) (name name name)) ((X opt-header) (name name name)) ((W opt-header) (name name name)) ((V opt-header) (name name name)) ((U opt-header) (name name name)) ((T opt-header) (name name name)) ((S opt-header) (name name name)) ((R opt-header) (name name name)) ((Q opt-header) (name name name)) ((P opt-header) (name name name)) ((O opt-header) (name name name)) ((N opt-header) (name name name)) ((M opt-header) (name name name)) ((L opt-header) (name name name)) ((K opt-header) (name name name)) ((J opt-header) (name name name)) ((I opt-header) (name name name)) ((H opt-header) (name name name)) ((G opt-header) (name name name)) ((F opt-header) (name name name)) ((E opt-header) (name name name)) ((D opt-header) (name name name)) ((C opt-header) (name name name)) ((B opt-header) (name name name)) ((A opt-header) (name name name)) ((@ opt-header) (name name name)) ((? opt-header) (name name name)) ((> opt-header) (name name name)) ((= opt-header) (name name name)) ((< opt-header) (name name name)) ((|;| opt-header) (name name name)) ((: opt-header) (name name name)) ((/ opt-header) (name name name)) ((. opt-header) (name name name)) ((- opt-header) (name name name)) ((, opt-header) (name name name)) ((+ opt-header) (name name name)) ((* opt-header) (name name name)) ((|)| opt-header) (name name name)) ((|(| opt-header) (name name name)) ((|'| opt-header) (name name name)) ((& opt-header) (name name name)) ((% opt-header) (name name name)) ((|#| opt-header) (name name name)) ((|"| opt-header) (name name name)) ((! opt-header) (name name name)) (($ opt-header) ()) ((|9| opt-header) ()) ((|8| opt-header) ()) ((|7| opt-header) ()) ((|6| opt-header) ()) ((|5| opt-header) ()) ((|4| opt-header) ()) ((|3| opt-header) ()) ((|2| opt-header) ()) ((|1| opt-header) ()) ((|0| opt-header) ()) ((|\n| opt-whites) (whites)) ((| | opt-whites) (whites)) (($ opt-whites) ()) ((|9| opt-whites) ()) ((|8| opt-whites) ()) ((|7| opt-whites) ()) ((|6| opt-whites) ()) ((|5| opt-whites) ()) ((|4| opt-whites) ()) ((|3| opt-whites) ()) ((|2| opt-whites) ()) ((|1| opt-whites) ()) ((|0| opt-whites) ()) ((\177 opt-whites) ()) ((|~| opt-whites) ()) ((|}| opt-whites) ()) ((|\|| opt-whites) ()) ((|{| opt-whites) ()) ((z opt-whites) ()) ((y opt-whites) ()) ((x opt-whites) ()) ((w opt-whites) ()) ((v opt-whites) ()) ((u opt-whites) ()) ((t opt-whites) ()) ((s opt-whites) ()) ((r opt-whites) ()) ((q opt-whites) ()) ((p opt-whites) ()) ((o opt-whites) ()) ((n opt-whites) ()) ((m opt-whites) ()) ((l opt-whites) ()) ((k opt-whites) ()) ((j opt-whites) ()) ((i opt-whites) ()) ((h opt-whites) ()) ((g opt-whites) ()) ((f opt-whites) ()) ((e opt-whites) ()) ((d opt-whites) ()) ((c opt-whites) ()) ((b opt-whites) ()) ((a opt-whites) ()) ((` opt-whites) ()) ((_ opt-whites) ()) ((^ opt-whites) ()) ((|]| opt-whites) ()) ((|\\| opt-whites) ()) ((|[| opt-whites) ()) ((Z opt-whites) ()) ((Y opt-whites) ()) ((X opt-whites) ()) ((W opt-whites) ()) ((V opt-whites) ()) ((U opt-whites) ()) ((T opt-whites) ()) ((S opt-whites) ()) ((R opt-whites) ()) ((Q opt-whites) ()) ((P opt-whites) ()) ((O opt-whites) ()) ((N opt-whites) ()) ((M opt-whites) ()) ((L opt-whites) ()) ((K opt-whites) ()) ((J opt-whites) ()) ((I opt-whites) ()) ((H opt-whites) ()) ((G opt-whites) ()) ((F opt-whites) ()) ((E opt-whites) ()) ((D opt-whites) ()) ((C opt-whites) ()) ((B opt-whites) ()) ((A opt-whites) ()) ((@ opt-whites) ()) ((? opt-whites) ()) ((> opt-whites) ()) ((= opt-whites) ()) ((< opt-whites) ()) ((|;| opt-whites) ()) ((: opt-whites) ()) ((/ opt-whites) ()) ((. opt-whites) ()) ((- opt-whites) ()) ((, opt-whites) ()) ((+ opt-whites) ()) ((* opt-whites) ()) ((|)| opt-whites) ()) ((|(| opt-whites) ()) ((|'| opt-whites) ()) ((& opt-whites) ()) ((% opt-whites) ()) ((|#| opt-whites) ()) ((|"| opt-whites) ()) ((! opt-whites) ()) ((|9| opt-profiles) (profile opt-profiles)) ((|8| opt-profiles) (profile opt-profiles)) ((|7| opt-profiles) (profile opt-profiles)) ((|6| opt-profiles) (profile opt-profiles)) ((|5| opt-profiles) (profile opt-profiles)) ((|4| opt-profiles) (profile opt-profiles)) ((|3| opt-profiles) (profile opt-profiles)) ((|2| opt-profiles) (profile opt-profiles)) ((|1| opt-profiles) (profile opt-profiles)) ((|0| opt-profiles) (profile opt-profiles)) (($ opt-profiles) ()) ((|9| profile) (number profile-p)) ((|8| profile) (number profile-p)) ((|7| profile) (number profile-p)) ((|6| profile) (number profile-p)) ((|5| profile) (number profile-p)) ((|4| profile) (number profile-p)) ((|3| profile) (number profile-p)) ((|2| profile) (number profile-p)) ((|1| profile) (number profile-p)) ((|0| profile) (number profile-p)) ((|9| profile-p) (callee)) ((|8| profile-p) (callee)) ((|7| profile-p) (callee)) ((|6| profile-p) (callee)) ((|5| profile-p) (callee)) ((|4| profile-p) (callee)) ((|3| profile-p) (callee)) ((|2| profile-p) (callee)) ((|1| profile-p) (callee)) ((|0| profile-p) (callee)) ((\177 profile-p) (caller)) ((|~| profile-p) (caller)) ((|}| profile-p) (caller)) ((|\|| profile-p) (caller)) ((|{| profile-p) (caller)) ((z profile-p) (caller)) ((y profile-p) (caller)) ((x profile-p) (caller)) ((w profile-p) (caller)) ((v profile-p) (caller)) ((u profile-p) (caller)) ((t profile-p) (caller)) ((s profile-p) (caller)) ((r profile-p) (caller)) ((q profile-p) (caller)) ((p profile-p) (caller)) ((o profile-p) (caller)) ((n profile-p) (caller)) ((m profile-p) (caller)) ((l profile-p) (caller)) ((k profile-p) (caller)) ((j profile-p) (caller)) ((i profile-p) (caller)) ((h profile-p) (caller)) ((g profile-p) (caller)) ((f profile-p) (caller)) ((e profile-p) (caller)) ((d profile-p) (caller)) ((c profile-p) (caller)) ((b profile-p) (caller)) ((a profile-p) (caller)) ((` profile-p) (caller)) ((_ profile-p) (caller)) ((^ profile-p) (caller)) ((|]| profile-p) (caller)) ((|\\| profile-p) (caller)) ((|[| profile-p) (caller)) ((Z profile-p) (caller)) ((Y profile-p) (caller)) ((X profile-p) (caller)) ((W profile-p) (caller)) ((V profile-p) (caller)) ((U profile-p) (caller)) ((T profile-p) (caller)) ((S profile-p) (caller)) ((R profile-p) (caller)) ((Q profile-p) (caller)) ((P profile-p) (caller)) ((O profile-p) (caller)) ((N profile-p) (caller)) ((M profile-p) (caller)) ((L profile-p) (caller)) ((K profile-p) (caller)) ((J profile-p) (caller)) ((I profile-p) (caller)) ((H profile-p) (caller)) ((G profile-p) (caller)) ((F profile-p) (caller)) ((E profile-p) (caller)) ((D profile-p) (caller)) ((C profile-p) (caller)) ((B profile-p) (caller)) ((A profile-p) (caller)) ((@ profile-p) (caller)) ((? profile-p) (caller)) ((> profile-p) (caller)) ((= profile-p) (caller)) ((< profile-p) (caller)) ((|;| profile-p) (caller)) ((: profile-p) (caller)) ((/ profile-p) (caller)) ((. profile-p) (caller)) ((- profile-p) (caller)) ((, profile-p) (caller)) ((+ profile-p) (caller)) ((* profile-p) (caller)) ((|)| profile-p) (caller)) ((|(| profile-p) (caller)) ((|'| profile-p) (caller)) ((& profile-p) (caller)) ((% profile-p) (caller)) ((|#| profile-p) (caller)) ((|"| profile-p) (caller)) ((! profile-p) (caller)) ((|9| callee) (number class name)) ((|8| callee) (number class name)) ((|7| callee) (number class name)) ((|6| callee) (number class name)) ((|5| callee) (number class name)) ((|4| callee) (number class name)) ((|3| callee) (number class name)) ((|2| callee) (number class name)) ((|1| callee) (number class name)) ((|0| callee) (number class name)) ((\177 caller) (name)) ((|~| caller) (name)) ((|}| caller) (name)) ((|\|| caller) (name)) ((|{| caller) (name)) ((z caller) (name)) ((y caller) (name)) ((x caller) (name)) ((w caller) (name)) ((v caller) (name)) ((u caller) (name)) ((t caller) (name)) ((s caller) (name)) ((r caller) (name)) ((q caller) (name)) ((p caller) (name)) ((o caller) (name)) ((n caller) (name)) ((m caller) (name)) ((l caller) (name)) ((k caller) (name)) ((j caller) (name)) ((i caller) (name)) ((h caller) (name)) ((g caller) (name)) ((f caller) (name)) ((e caller) (name)) ((d caller) (name)) ((c caller) (name)) ((b caller) (name)) ((a caller) (name)) ((` caller) (name)) ((_ caller) (name)) ((^ caller) (name)) ((|]| caller) (name)) ((|\\| caller) (name)) ((|[| caller) (name)) ((Z caller) (name)) ((Y caller) (name)) ((X caller) (name)) ((W caller) (name)) ((V caller) (name)) ((U caller) (name)) ((T caller) (name)) ((S caller) (name)) ((R caller) (name)) ((Q caller) (name)) ((P caller) (name)) ((O caller) (name)) ((N caller) (name)) ((M caller) (name)) ((L caller) (name)) ((K caller) (name)) ((J caller) (name)) ((I caller) (name)) ((H caller) (name)) ((G caller) (name)) ((F caller) (name)) ((E caller) (name)) ((D caller) (name)) ((C caller) (name)) ((B caller) (name)) ((A caller) (name)) ((@ caller) (name)) ((? caller) (name)) ((> caller) (name)) ((= caller) (name)) ((< caller) (name)) ((|;| caller) (name)) ((: caller) (name)) ((/ caller) (name)) ((. caller) (name)) ((- caller) (name)) ((, caller) (name)) ((+ caller) (name)) ((* caller) (name)) ((|)| caller) (name)) ((|(| caller) (name)) ((|'| caller) (name)) ((& caller) (name)) ((% caller) (name)) ((|#| caller) (name)) ((|"| caller) (name)) ((! caller) (name)) ((U class) (U whites)) ((B class) (B whites)) ((|9| number) ("CLEAR" digits "PUSH" whites)) ((|8| number) ("CLEAR" digits "PUSH" whites)) ((|7| number) ("CLEAR" digits "PUSH" whites)) ((|6| number) ("CLEAR" digits "PUSH" whites)) ((|5| number) ("CLEAR" digits "PUSH" whites)) ((|4| number) ("CLEAR" digits "PUSH" whites)) ((|3| number) ("CLEAR" digits "PUSH" whites)) ((|2| number) ("CLEAR" digits "PUSH" whites)) ((|1| number) ("CLEAR" digits "PUSH" whites)) ((|0| number) ("CLEAR" digits "PUSH" whites)) ((\177 name) ("START-NAME" letters "END-NAME" whites)) ((|~| name) ("START-NAME" letters "END-NAME" whites)) ((|}| name) ("START-NAME" letters "END-NAME" whites)) ((|\|| name) ("START-NAME" letters "END-NAME" whites)) ((|{| name) ("START-NAME" letters "END-NAME" whites)) ((z name) ("START-NAME" letters "END-NAME" whites)) ((y name) ("START-NAME" letters "END-NAME" whites)) ((x name) ("START-NAME" letters "END-NAME" whites)) ((w name) ("START-NAME" letters "END-NAME" whites)) ((v name) ("START-NAME" letters "END-NAME" whites)) ((u name) ("START-NAME" letters "END-NAME" whites)) ((t name) ("START-NAME" letters "END-NAME" whites)) ((s name) ("START-NAME" letters "END-NAME" whites)) ((r name) ("START-NAME" letters "END-NAME" whites)) ((q name) ("START-NAME" letters "END-NAME" whites)) ((p name) ("START-NAME" letters "END-NAME" whites)) ((o name) ("START-NAME" letters "END-NAME" whites)) ((n name) ("START-NAME" letters "END-NAME" whites)) ((m name) ("START-NAME" letters "END-NAME" whites)) ((l name) ("START-NAME" letters "END-NAME" whites)) ((k name) ("START-NAME" letters "END-NAME" whites)) ((j name) ("START-NAME" letters "END-NAME" whites)) ((i name) ("START-NAME" letters "END-NAME" whites)) ((h name) ("START-NAME" letters "END-NAME" whites)) ((g name) ("START-NAME" letters "END-NAME" whites)) ((f name) ("START-NAME" letters "END-NAME" whites)) ((e name) ("START-NAME" letters "END-NAME" whites)) ((d name) ("START-NAME" letters "END-NAME" whites)) ((c name) ("START-NAME" letters "END-NAME" whites)) ((b name) ("START-NAME" letters "END-NAME" whites)) ((a name) ("START-NAME" letters "END-NAME" whites)) ((` name) ("START-NAME" letters "END-NAME" whites)) ((_ name) ("START-NAME" letters "END-NAME" whites)) ((^ name) ("START-NAME" letters "END-NAME" whites)) ((|]| name) ("START-NAME" letters "END-NAME" whites)) ((|\\| name) ("START-NAME" letters "END-NAME" whites)) ((|[| name) ("START-NAME" letters "END-NAME" whites)) ((Z name) ("START-NAME" letters "END-NAME" whites)) ((Y name) ("START-NAME" letters "END-NAME" whites)) ((X name) ("START-NAME" letters "END-NAME" whites)) ((W name) ("START-NAME" letters "END-NAME" whites)) ((V name) ("START-NAME" letters "END-NAME" whites)) ((U name) ("START-NAME" letters "END-NAME" whites)) ((T name) ("START-NAME" letters "END-NAME" whites)) ((S name) ("START-NAME" letters "END-NAME" whites)) ((R name) ("START-NAME" letters "END-NAME" whites)) ((Q name) ("START-NAME" letters "END-NAME" whites)) ((P name) ("START-NAME" letters "END-NAME" whites)) ((O name) ("START-NAME" letters "END-NAME" whites)) ((N name) ("START-NAME" letters "END-NAME" whites)) ((M name) ("START-NAME" letters "END-NAME" whites)) ((L name) ("START-NAME" letters "END-NAME" whites)) ((K name) ("START-NAME" letters "END-NAME" whites)) ((J name) ("START-NAME" letters "END-NAME" whites)) ((I name) ("START-NAME" letters "END-NAME" whites)) ((H name) ("START-NAME" letters "END-NAME" whites)) ((G name) ("START-NAME" letters "END-NAME" whites)) ((F name) ("START-NAME" letters "END-NAME" whites)) ((E name) ("START-NAME" letters "END-NAME" whites)) ((D name) ("START-NAME" letters "END-NAME" whites)) ((C name) ("START-NAME" letters "END-NAME" whites)) ((B name) ("START-NAME" letters "END-NAME" whites)) ((A name) ("START-NAME" letters "END-NAME" whites)) ((@ name) ("START-NAME" letters "END-NAME" whites)) ((? name) ("START-NAME" letters "END-NAME" whites)) ((> name) ("START-NAME" letters "END-NAME" whites)) ((= name) ("START-NAME" letters "END-NAME" whites)) ((< name) ("START-NAME" letters "END-NAME" whites)) ((|;| name) ("START-NAME" letters "END-NAME" whites)) ((: name) ("START-NAME" letters "END-NAME" whites)) ((/ name) ("START-NAME" letters "END-NAME" whites)) ((. name) ("START-NAME" letters "END-NAME" whites)) ((- name) ("START-NAME" letters "END-NAME" whites)) ((, name) ("START-NAME" letters "END-NAME" whites)) ((+ name) ("START-NAME" letters "END-NAME" whites)) ((* name) ("START-NAME" letters "END-NAME" whites)) ((|)| name) ("START-NAME" letters "END-NAME" whites)) ((|(| name) ("START-NAME" letters "END-NAME" whites)) ((|'| name) ("START-NAME" letters "END-NAME" whites)) ((& name) ("START-NAME" letters "END-NAME" whites)) ((% name) ("START-NAME" letters "END-NAME" whites)) ((|#| name) ("START-NAME" letters "END-NAME" whites)) ((|"| name) ("START-NAME" letters "END-NAME" whites)) ((! name) ("START-NAME" letters "END-NAME" whites)) ((|9| digits) ("ADD-DIGIT" digit more-digits)) ((|8| digits) ("ADD-DIGIT" digit more-digits)) ((|7| digits) ("ADD-DIGIT" digit more-digits)) ((|6| digits) ("ADD-DIGIT" digit more-digits)) ((|5| digits) ("ADD-DIGIT" digit more-digits)) ((|4| digits) ("ADD-DIGIT" digit more-digits)) ((|3| digits) ("ADD-DIGIT" digit more-digits)) ((|2| digits) ("ADD-DIGIT" digit more-digits)) ((|1| digits) ("ADD-DIGIT" digit more-digits)) ((|0| digits) ("ADD-DIGIT" digit more-digits)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|\n| more-digits) ()) ((| | more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ((\177 letters) ("ADD-LETTER" letter more-letters)) ((|~| letters) ("ADD-LETTER" letter more-letters)) ((|}| letters) ("ADD-LETTER" letter more-letters)) ((|\|| letters) ("ADD-LETTER" letter more-letters)) ((|{| letters) ("ADD-LETTER" letter more-letters)) ((z letters) ("ADD-LETTER" letter more-letters)) ((y letters) ("ADD-LETTER" letter more-letters)) ((x letters) ("ADD-LETTER" letter more-letters)) ((w letters) ("ADD-LETTER" letter more-letters)) ((v letters) ("ADD-LETTER" letter more-letters)) ((u letters) ("ADD-LETTER" letter more-letters)) ((t letters) ("ADD-LETTER" letter more-letters)) ((s letters) ("ADD-LETTER" letter more-letters)) ((r letters) ("ADD-LETTER" letter more-letters)) ((q letters) ("ADD-LETTER" letter more-letters)) ((p letters) ("ADD-LETTER" letter more-letters)) ((o letters) ("ADD-LETTER" letter more-letters)) ((n letters) ("ADD-LETTER" letter more-letters)) ((m letters) ("ADD-LETTER" letter more-letters)) ((l letters) ("ADD-LETTER" letter more-letters)) ((k letters) ("ADD-LETTER" letter more-letters)) ((j letters) ("ADD-LETTER" letter more-letters)) ((i letters) ("ADD-LETTER" letter more-letters)) ((h letters) ("ADD-LETTER" letter more-letters)) ((g letters) ("ADD-LETTER" letter more-letters)) ((f letters) ("ADD-LETTER" letter more-letters)) ((e letters) ("ADD-LETTER" letter more-letters)) ((d letters) ("ADD-LETTER" letter more-letters)) ((c letters) ("ADD-LETTER" letter more-letters)) ((b letters) ("ADD-LETTER" letter more-letters)) ((a letters) ("ADD-LETTER" letter more-letters)) ((` letters) ("ADD-LETTER" letter more-letters)) ((_ letters) ("ADD-LETTER" letter more-letters)) ((^ letters) ("ADD-LETTER" letter more-letters)) ((|]| letters) ("ADD-LETTER" letter more-letters)) ((|\\| letters) ("ADD-LETTER" letter more-letters)) ((|[| letters) ("ADD-LETTER" letter more-letters)) ((Z letters) ("ADD-LETTER" letter more-letters)) ((Y letters) ("ADD-LETTER" letter more-letters)) ((X letters) ("ADD-LETTER" letter more-letters)) ((W letters) ("ADD-LETTER" letter more-letters)) ((V letters) ("ADD-LETTER" letter more-letters)) ((U letters) ("ADD-LETTER" letter more-letters)) ((T letters) ("ADD-LETTER" letter more-letters)) ((S letters) ("ADD-LETTER" letter more-letters)) ((R letters) ("ADD-LETTER" letter more-letters)) ((Q letters) ("ADD-LETTER" letter more-letters)) ((P letters) ("ADD-LETTER" letter more-letters)) ((O letters) ("ADD-LETTER" letter more-letters)) ((N letters) ("ADD-LETTER" letter more-letters)) ((M letters) ("ADD-LETTER" letter more-letters)) ((L letters) ("ADD-LETTER" letter more-letters)) ((K letters) ("ADD-LETTER" letter more-letters)) ((J letters) ("ADD-LETTER" letter more-letters)) ((I letters) ("ADD-LETTER" letter more-letters)) ((H letters) ("ADD-LETTER" letter more-letters)) ((G letters) ("ADD-LETTER" letter more-letters)) ((F letters) ("ADD-LETTER" letter more-letters)) ((E letters) ("ADD-LETTER" letter more-letters)) ((D letters) ("ADD-LETTER" letter more-letters)) ((C letters) ("ADD-LETTER" letter more-letters)) ((B letters) ("ADD-LETTER" letter more-letters)) ((A letters) ("ADD-LETTER" letter more-letters)) ((@ letters) ("ADD-LETTER" letter more-letters)) ((? letters) ("ADD-LETTER" letter more-letters)) ((> letters) ("ADD-LETTER" letter more-letters)) ((= letters) ("ADD-LETTER" letter more-letters)) ((< letters) ("ADD-LETTER" letter more-letters)) ((|;| letters) ("ADD-LETTER" letter more-letters)) ((: letters) ("ADD-LETTER" letter more-letters)) ((/ letters) ("ADD-LETTER" letter more-letters)) ((. letters) ("ADD-LETTER" letter more-letters)) ((- letters) ("ADD-LETTER" letter more-letters)) ((, letters) ("ADD-LETTER" letter more-letters)) ((+ letters) ("ADD-LETTER" letter more-letters)) ((* letters) ("ADD-LETTER" letter more-letters)) ((|)| letters) ("ADD-LETTER" letter more-letters)) ((|(| letters) ("ADD-LETTER" letter more-letters)) ((|'| letters) ("ADD-LETTER" letter more-letters)) ((& letters) ("ADD-LETTER" letter more-letters)) ((% letters) ("ADD-LETTER" letter more-letters)) ((|#| letters) ("ADD-LETTER" letter more-letters)) ((|"| letters) ("ADD-LETTER" letter more-letters)) ((! letters) ("ADD-LETTER" letter more-letters)) ((\177 more-letters) ("ADD-LETTER" letter more-letters)) ((|~| more-letters) ("ADD-LETTER" letter more-letters)) ((|}| more-letters) ("ADD-LETTER" letter more-letters)) ((|\|| more-letters) ("ADD-LETTER" letter more-letters)) ((|{| more-letters) ("ADD-LETTER" letter more-letters)) ((z more-letters) ("ADD-LETTER" letter more-letters)) ((y more-letters) ("ADD-LETTER" letter more-letters)) ((x more-letters) ("ADD-LETTER" letter more-letters)) ((w more-letters) ("ADD-LETTER" letter more-letters)) ((v more-letters) ("ADD-LETTER" letter more-letters)) ((u more-letters) ("ADD-LETTER" letter more-letters)) ((t more-letters) ("ADD-LETTER" letter more-letters)) ((s more-letters) ("ADD-LETTER" letter more-letters)) ((r more-letters) ("ADD-LETTER" letter more-letters)) ((q more-letters) ("ADD-LETTER" letter more-letters)) ((p more-letters) ("ADD-LETTER" letter more-letters)) ((o more-letters) ("ADD-LETTER" letter more-letters)) ((n more-letters) ("ADD-LETTER" letter more-letters)) ((m more-letters) ("ADD-LETTER" letter more-letters)) ((l more-letters) ("ADD-LETTER" letter more-letters)) ((k more-letters) ("ADD-LETTER" letter more-letters)) ((j more-letters) ("ADD-LETTER" letter more-letters)) ((i more-letters) ("ADD-LETTER" letter more-letters)) ((h more-letters) ("ADD-LETTER" letter more-letters)) ((g more-letters) ("ADD-LETTER" letter more-letters)) ((f more-letters) ("ADD-LETTER" letter more-letters)) ((e more-letters) ("ADD-LETTER" letter more-letters)) ((d more-letters) ("ADD-LETTER" letter more-letters)) ((c more-letters) ("ADD-LETTER" letter more-letters)) ((b more-letters) ("ADD-LETTER" letter more-letters)) ((a more-letters) ("ADD-LETTER" letter more-letters)) ((` more-letters) ("ADD-LETTER" letter more-letters)) ((_ more-letters) ("ADD-LETTER" letter more-letters)) ((^ more-letters) ("ADD-LETTER" letter more-letters)) ((|]| more-letters) ("ADD-LETTER" letter more-letters)) ((|\\| more-letters) ("ADD-LETTER" letter more-letters)) ((|[| more-letters) ("ADD-LETTER" letter more-letters)) ((Z more-letters) ("ADD-LETTER" letter more-letters)) ((Y more-letters) ("ADD-LETTER" letter more-letters)) ((X more-letters) ("ADD-LETTER" letter more-letters)) ((W more-letters) ("ADD-LETTER" letter more-letters)) ((V more-letters) ("ADD-LETTER" letter more-letters)) ((U more-letters) ("ADD-LETTER" letter more-letters)) ((T more-letters) ("ADD-LETTER" letter more-letters)) ((S more-letters) ("ADD-LETTER" letter more-letters)) ((R more-letters) ("ADD-LETTER" letter more-letters)) ((Q more-letters) ("ADD-LETTER" letter more-letters)) ((P more-letters) ("ADD-LETTER" letter more-letters)) ((O more-letters) ("ADD-LETTER" letter more-letters)) ((N more-letters) ("ADD-LETTER" letter more-letters)) ((M more-letters) ("ADD-LETTER" letter more-letters)) ((L more-letters) ("ADD-LETTER" letter more-letters)) ((K more-letters) ("ADD-LETTER" letter more-letters)) ((J more-letters) ("ADD-LETTER" letter more-letters)) ((I more-letters) ("ADD-LETTER" letter more-letters)) ((H more-letters) ("ADD-LETTER" letter more-letters)) ((G more-letters) ("ADD-LETTER" letter more-letters)) ((F more-letters) ("ADD-LETTER" letter more-letters)) ((E more-letters) ("ADD-LETTER" letter more-letters)) ((D more-letters) ("ADD-LETTER" letter more-letters)) ((C more-letters) ("ADD-LETTER" letter more-letters)) ((B more-letters) ("ADD-LETTER" letter more-letters)) ((A more-letters) ("ADD-LETTER" letter more-letters)) ((@ more-letters) ("ADD-LETTER" letter more-letters)) ((? more-letters) ("ADD-LETTER" letter more-letters)) ((> more-letters) ("ADD-LETTER" letter more-letters)) ((= more-letters) ("ADD-LETTER" letter more-letters)) ((< more-letters) ("ADD-LETTER" letter more-letters)) ((|;| more-letters) ("ADD-LETTER" letter more-letters)) ((: more-letters) ("ADD-LETTER" letter more-letters)) ((/ more-letters) ("ADD-LETTER" letter more-letters)) ((. more-letters) ("ADD-LETTER" letter more-letters)) ((- more-letters) ("ADD-LETTER" letter more-letters)) ((, more-letters) ("ADD-LETTER" letter more-letters)) ((+ more-letters) ("ADD-LETTER" letter more-letters)) ((* more-letters) ("ADD-LETTER" letter more-letters)) ((|)| more-letters) ("ADD-LETTER" letter more-letters)) ((|(| more-letters) ("ADD-LETTER" letter more-letters)) ((|'| more-letters) ("ADD-LETTER" letter more-letters)) ((& more-letters) ("ADD-LETTER" letter more-letters)) ((% more-letters) ("ADD-LETTER" letter more-letters)) ((|#| more-letters) ("ADD-LETTER" letter more-letters)) ((|"| more-letters) ("ADD-LETTER" letter more-letters)) ((! more-letters) ("ADD-LETTER" letter more-letters)) ((|\n| more-letters) ()) ((| | more-letters) ()) ((|\n| whites) (white more-whites)) ((| | whites) (white more-whites)) ((|\n| more-whites) (white more-whites)) ((| | more-whites) (white more-whites)) (($ more-whites) ()) ((|9| more-whites) ()) ((|8| more-whites) ()) ((|7| more-whites) ()) ((|6| more-whites) ()) ((|5| more-whites) ()) ((|4| more-whites) ()) ((|3| more-whites) ()) ((|2| more-whites) ()) ((|1| more-whites) ()) ((|0| more-whites) ()) ((\177 more-whites) ()) ((|~| more-whites) ()) ((|}| more-whites) ()) ((|\|| more-whites) ()) ((|{| more-whites) ()) ((z more-whites) ()) ((y more-whites) ()) ((x more-whites) ()) ((w more-whites) ()) ((v more-whites) ()) ((u more-whites) ()) ((t more-whites) ()) ((s more-whites) ()) ((r more-whites) ()) ((q more-whites) ()) ((p more-whites) ()) ((o more-whites) ()) ((n more-whites) ()) ((m more-whites) ()) ((l more-whites) ()) ((k more-whites) ()) ((j more-whites) ()) ((i more-whites) ()) ((h more-whites) ()) ((g more-whites) ()) ((f more-whites) ()) ((e more-whites) ()) ((d more-whites) ()) ((c more-whites) ()) ((b more-whites) ()) ((a more-whites) ()) ((` more-whites) ()) ((_ more-whites) ()) ((^ more-whites) ()) ((|]| more-whites) ()) ((|\\| more-whites) ()) ((|[| more-whites) ()) ((Z more-whites) ()) ((Y more-whites) ()) ((X more-whites) ()) ((W more-whites) ()) ((V more-whites) ()) ((U more-whites) ()) ((T more-whites) ()) ((S more-whites) ()) ((R more-whites) ()) ((Q more-whites) ()) ((P more-whites) ()) ((O more-whites) ()) ((N more-whites) ()) ((M more-whites) ()) ((L more-whites) ()) ((K more-whites) ()) ((J more-whites) ()) ((I more-whites) ()) ((H more-whites) ()) ((G more-whites) ()) ((F more-whites) ()) ((E more-whites) ()) ((D more-whites) ()) ((C more-whites) ()) ((B more-whites) ()) ((A more-whites) ()) ((@ more-whites) ()) ((? more-whites) ()) ((> more-whites) ()) ((= more-whites) ()) ((< more-whites) ()) ((|;| more-whites) ()) ((: more-whites) ()) ((/ more-whites) ()) ((. more-whites) ()) ((- more-whites) ()) ((, more-whites) ()) ((+ more-whites) ()) ((* more-whites) ()) ((|)| more-whites) ()) ((|(| more-whites) ()) ((|'| more-whites) ()) ((& more-whites) ()) ((% more-whites) ()) ((|#| more-whites) ()) ((|"| more-whites) ()) ((! more-whites) ()) ((| | white) (| |)) ((|\n| white) (|\n|)) ((! letter) (!)) ((|"| letter) (|"|)) ((|#| letter) (|#|)) ((% letter) (%)) ((& letter) (&)) ((|'| letter) (|'|)) ((|(| letter) (|(|)) ((|)| letter) (|)|)) ((* letter) (*)) ((+ letter) (+)) ((, letter) (,)) ((- letter) (-)) ((. letter) (.)) ((/ letter) (/)) ((: letter) (:)) ((|;| letter) (|;|)) ((< letter) (<)) ((= letter) (=)) ((> letter) (>)) ((? letter) (?)) ((@ letter) (@)) ((A letter) (A)) ((B letter) (B)) ((C letter) (C)) ((D letter) (D)) ((E letter) (E)) ((F letter) (F)) ((G letter) (G)) ((H letter) (H)) ((I letter) (I)) ((J letter) (J)) ((K letter) (K)) ((L letter) (L)) ((M letter) (M)) ((N letter) (N)) ((O letter) (O)) ((P letter) (P)) ((Q letter) (Q)) ((R letter) (R)) ((S letter) (S)) ((T letter) (T)) ((U letter) (U)) ((V letter) (V)) ((W letter) (W)) ((X letter) (X)) ((Y letter) (Y)) ((Z letter) (Z)) ((|[| letter) (|[|)) ((|\\| letter) (|\\|)) ((|]| letter) (|]|)) ((^ letter) (^)) ((_ letter) (_)) ((` letter) (`)) ((a letter) (a)) ((b letter) (b)) ((c letter) (c)) ((d letter) (d)) ((e letter) (e)) ((f letter) (f)) ((g letter) (g)) ((h letter) (h)) ((i letter) (i)) ((j letter) (j)) ((k letter) (k)) ((l letter) (l)) ((m letter) (m)) ((n letter) (n)) ((o letter) (o)) ((p letter) (p)) ((q letter) (q)) ((r letter) (r)) ((s letter) (s)) ((t letter) (t)) ((u letter) (u)) ((v letter) (v)) ((w letter) (w)) ((x letter) (x)) ((y letter) (y)) ((z letter) (z)) ((|{| letter) (|{|)) ((|\|| letter) (|\||)) ((|}| letter) (|}|)) ((|~| letter) (|~|)) ((\177 letter) (\177)) ) lola-1.6/test/prof.h000066400000000000000000000640061414126705100144140ustar00rootroot00000000000000(\177 |~| |}| |\|| |{| z y x w v u t s r q p o n m l k j i h g f e d c b a ` _ ^ |]| |\\| |[| Z Y X W V U T S R Q P O N M L K J I H G F E D C B A @ ? > = < |;| : / . - , + * |)| |(| |'| & % $ |#| |"| ! |9| |8| |7| |6| |5| |4| |3| |2| |1| |0| |\n| | |) (profile-file opt-profiles profiles profile callee callers caller class number digits more-digits digit name name-end opt-white whites white printable letter opt-header profilesp digitsp) ( ((\177 profile-file) (opt-header opt-white opt-profiles)) ((|~| profile-file) (opt-header opt-white opt-profiles)) ((|}| profile-file) (opt-header opt-white opt-profiles)) ((|\|| profile-file) (opt-header opt-white opt-profiles)) ((|{| profile-file) (opt-header opt-white opt-profiles)) ((z profile-file) (opt-header opt-white opt-profiles)) ((y profile-file) (opt-header opt-white opt-profiles)) ((x profile-file) (opt-header opt-white opt-profiles)) ((w profile-file) (opt-header opt-white opt-profiles)) ((v profile-file) (opt-header opt-white opt-profiles)) ((u profile-file) (opt-header opt-white opt-profiles)) ((t profile-file) (opt-header opt-white opt-profiles)) ((s profile-file) (opt-header opt-white opt-profiles)) ((r profile-file) (opt-header opt-white opt-profiles)) ((q profile-file) (opt-header opt-white opt-profiles)) ((p profile-file) (opt-header opt-white opt-profiles)) ((o profile-file) (opt-header opt-white opt-profiles)) ((n profile-file) (opt-header opt-white opt-profiles)) ((m profile-file) (opt-header opt-white opt-profiles)) ((l profile-file) (opt-header opt-white opt-profiles)) ((k profile-file) (opt-header opt-white opt-profiles)) ((j profile-file) (opt-header opt-white opt-profiles)) ((i profile-file) (opt-header opt-white opt-profiles)) ((h profile-file) (opt-header opt-white opt-profiles)) ((g profile-file) (opt-header opt-white opt-profiles)) ((f profile-file) (opt-header opt-white opt-profiles)) ((e profile-file) (opt-header opt-white opt-profiles)) ((d profile-file) (opt-header opt-white opt-profiles)) ((c profile-file) (opt-header opt-white opt-profiles)) ((b profile-file) (opt-header opt-white opt-profiles)) ((a profile-file) (opt-header opt-white opt-profiles)) ((` profile-file) (opt-header opt-white opt-profiles)) ((_ profile-file) (opt-header opt-white opt-profiles)) ((^ profile-file) (opt-header opt-white opt-profiles)) ((|]| profile-file) (opt-header opt-white opt-profiles)) ((|\\| profile-file) (opt-header opt-white opt-profiles)) ((|[| profile-file) (opt-header opt-white opt-profiles)) ((Z profile-file) (opt-header opt-white opt-profiles)) ((Y profile-file) (opt-header opt-white opt-profiles)) ((X profile-file) (opt-header opt-white opt-profiles)) ((W profile-file) (opt-header opt-white opt-profiles)) ((V profile-file) (opt-header opt-white opt-profiles)) ((U profile-file) (opt-header opt-white opt-profiles)) ((T profile-file) (opt-header opt-white opt-profiles)) ((S profile-file) (opt-header opt-white opt-profiles)) ((R profile-file) (opt-header opt-white opt-profiles)) ((Q profile-file) (opt-header opt-white opt-profiles)) ((P profile-file) (opt-header opt-white opt-profiles)) ((O profile-file) (opt-header opt-white opt-profiles)) ((N profile-file) (opt-header opt-white opt-profiles)) ((M profile-file) (opt-header opt-white opt-profiles)) ((L profile-file) (opt-header opt-white opt-profiles)) ((K profile-file) (opt-header opt-white opt-profiles)) ((J profile-file) (opt-header opt-white opt-profiles)) ((I profile-file) (opt-header opt-white opt-profiles)) ((H profile-file) (opt-header opt-white opt-profiles)) ((G profile-file) (opt-header opt-white opt-profiles)) ((F profile-file) (opt-header opt-white opt-profiles)) ((E profile-file) (opt-header opt-white opt-profiles)) ((D profile-file) (opt-header opt-white opt-profiles)) ((C profile-file) (opt-header opt-white opt-profiles)) ((B profile-file) (opt-header opt-white opt-profiles)) ((A profile-file) (opt-header opt-white opt-profiles)) ((@ profile-file) (opt-header opt-white opt-profiles)) ((? profile-file) (opt-header opt-white opt-profiles)) ((> profile-file) (opt-header opt-white opt-profiles)) ((= profile-file) (opt-header opt-white opt-profiles)) ((< profile-file) (opt-header opt-white opt-profiles)) ((|;| profile-file) (opt-header opt-white opt-profiles)) ((: profile-file) (opt-header opt-white opt-profiles)) ((/ profile-file) (opt-header opt-white opt-profiles)) ((. profile-file) (opt-header opt-white opt-profiles)) ((- profile-file) (opt-header opt-white opt-profiles)) ((, profile-file) (opt-header opt-white opt-profiles)) ((+ profile-file) (opt-header opt-white opt-profiles)) ((* profile-file) (opt-header opt-white opt-profiles)) ((|)| profile-file) (opt-header opt-white opt-profiles)) ((|(| profile-file) (opt-header opt-white opt-profiles)) ((|'| profile-file) (opt-header opt-white opt-profiles)) ((& profile-file) (opt-header opt-white opt-profiles)) ((% profile-file) (opt-header opt-white opt-profiles)) (($ profile-file) (opt-header opt-white opt-profiles)) ((|#| profile-file) (opt-header opt-white opt-profiles)) ((|"| profile-file) (opt-header opt-white opt-profiles)) ((! profile-file) (opt-header opt-white opt-profiles)) ((|\n| profile-file) (opt-header opt-white opt-profiles)) ((| | profile-file) (opt-header opt-white opt-profiles)) ((|9| opt-profiles) (profiles)) ((|8| opt-profiles) (profiles)) ((|7| opt-profiles) (profiles)) ((|6| opt-profiles) (profiles)) ((|5| opt-profiles) (profiles)) ((|4| opt-profiles) (profiles)) ((|3| opt-profiles) (profiles)) ((|2| opt-profiles) (profiles)) ((|1| opt-profiles) (profiles)) ((|0| opt-profiles) (profiles)) ((|\n| opt-profiles) (profiles)) ((| | opt-profiles) (profiles)) (($ opt-profiles) ()) ((|9| profiles) (profile profilesp)) ((|8| profiles) (profile profilesp)) ((|7| profiles) (profile profilesp)) ((|6| profiles) (profile profilesp)) ((|5| profiles) (profile profilesp)) ((|4| profiles) (profile profilesp)) ((|3| profiles) (profile profilesp)) ((|2| profiles) (profile profilesp)) ((|1| profiles) (profile profilesp)) ((|0| profiles) (profile profilesp)) ((|\n| profiles) (profile profilesp)) ((| | profiles) (profile profilesp)) ((|9| profile) (callee callers)) ((|8| profile) (callee callers)) ((|7| profile) (callee callers)) ((|6| profile) (callee callers)) ((|5| profile) (callee callers)) ((|4| profile) (callee callers)) ((|3| profile) (callee callers)) ((|2| profile) (callee callers)) ((|1| profile) (callee callers)) ((|0| profile) (callee callers)) ((|\n| profile) (callee callers)) ((| | profile) (callee callers)) ((|9| callee) (opt-white number whites number whites class whites name)) ((|8| callee) (opt-white number whites number whites class whites name)) ((|7| callee) (opt-white number whites number whites class whites name)) ((|6| callee) (opt-white number whites number whites class whites name)) ((|5| callee) (opt-white number whites number whites class whites name)) ((|4| callee) (opt-white number whites number whites class whites name)) ((|3| callee) (opt-white number whites number whites class whites name)) ((|2| callee) (opt-white number whites number whites class whites name)) ((|1| callee) (opt-white number whites number whites class whites name)) ((|0| callee) (opt-white number whites number whites class whites name)) ((|\n| callee) (opt-white number whites number whites class whites name)) ((| | callee) (opt-white number whites number whites class whites name)) ((|\n| callers) (whites caller callers)) ((| | callers) (whites caller callers)) (($ callers) ()) ((|\n| callers) ()) ((| | callers) ()) ((|9| caller) (number whites name)) ((|8| caller) (number whites name)) ((|7| caller) (number whites name)) ((|6| caller) (number whites name)) ((|5| caller) (number whites name)) ((|4| caller) (number whites name)) ((|3| caller) (number whites name)) ((|2| caller) (number whites name)) ((|1| caller) (number whites name)) ((|0| caller) (number whites name)) ((U class) (U)) ((B class) (B)) ((|9| number) ("CLEAR" digits)) ((|8| number) ("CLEAR" digits)) ((|7| number) ("CLEAR" digits)) ((|6| number) ("CLEAR" digits)) ((|5| number) ("CLEAR" digits)) ((|4| number) ("CLEAR" digits)) ((|3| number) ("CLEAR" digits)) ((|2| number) ("CLEAR" digits)) ((|1| number) ("CLEAR" digits)) ((|0| number) ("CLEAR" digits)) ((|9| digits) ("ADD-DIGIT" digit digitsp)) ((|8| digits) ("ADD-DIGIT" digit digitsp)) ((|7| digits) ("ADD-DIGIT" digit digitsp)) ((|6| digits) ("ADD-DIGIT" digit digitsp)) ((|5| digits) ("ADD-DIGIT" digit digitsp)) ((|4| digits) ("ADD-DIGIT" digit digitsp)) ((|3| digits) ("ADD-DIGIT" digit digitsp)) ((|2| digits) ("ADD-DIGIT" digit digitsp)) ((|1| digits) ("ADD-DIGIT" digit digitsp)) ((|0| digits) ("ADD-DIGIT" digit digitsp)) ((|9| more-digits) ("ADD-DIGIT" digit more-digits)) ((|8| more-digits) ("ADD-DIGIT" digit more-digits)) ((|7| more-digits) ("ADD-DIGIT" digit more-digits)) ((|6| more-digits) ("ADD-DIGIT" digit more-digits)) ((|5| more-digits) ("ADD-DIGIT" digit more-digits)) ((|4| more-digits) ("ADD-DIGIT" digit more-digits)) ((|3| more-digits) ("ADD-DIGIT" digit more-digits)) ((|2| more-digits) ("ADD-DIGIT" digit more-digits)) ((|1| more-digits) ("ADD-DIGIT" digit more-digits)) ((|0| more-digits) ("ADD-DIGIT" digit more-digits)) ((|\n| more-digits) ()) ((| | more-digits) ()) ((|0| digit) (|0|)) ((|1| digit) (|1|)) ((|2| digit) (|2|)) ((|3| digit) (|3|)) ((|4| digit) (|4|)) ((|5| digit) (|5|)) ((|6| digit) (|6|)) ((|7| digit) (|7|)) ((|8| digit) (|8|)) ((|9| digit) (|9|)) ((\177 name) (letter name-end)) ((|~| name) (letter name-end)) ((|}| name) (letter name-end)) ((|\|| name) (letter name-end)) ((|{| name) (letter name-end)) ((z name) (letter name-end)) ((y name) (letter name-end)) ((x name) (letter name-end)) ((w name) (letter name-end)) ((v name) (letter name-end)) ((u name) (letter name-end)) ((t name) (letter name-end)) ((s name) (letter name-end)) ((r name) (letter name-end)) ((q name) (letter name-end)) ((p name) (letter name-end)) ((o name) (letter name-end)) ((n name) (letter name-end)) ((m name) (letter name-end)) ((l name) (letter name-end)) ((k name) (letter name-end)) ((j name) (letter name-end)) ((i name) (letter name-end)) ((h name) (letter name-end)) ((g name) (letter name-end)) ((f name) (letter name-end)) ((e name) (letter name-end)) ((d name) (letter name-end)) ((c name) (letter name-end)) ((b name) (letter name-end)) ((a name) (letter name-end)) ((` name) (letter name-end)) ((_ name) (letter name-end)) ((^ name) (letter name-end)) ((|]| name) (letter name-end)) ((|\\| name) (letter name-end)) ((|[| name) (letter name-end)) ((Z name) (letter name-end)) ((Y name) (letter name-end)) ((X name) (letter name-end)) ((W name) (letter name-end)) ((V name) (letter name-end)) ((U name) (letter name-end)) ((T name) (letter name-end)) ((S name) (letter name-end)) ((R name) (letter name-end)) ((Q name) (letter name-end)) ((P name) (letter name-end)) ((O name) (letter name-end)) ((N name) (letter name-end)) ((M name) (letter name-end)) ((L name) (letter name-end)) ((K name) (letter name-end)) ((J name) (letter name-end)) ((I name) (letter name-end)) ((H name) (letter name-end)) ((G name) (letter name-end)) ((F name) (letter name-end)) ((E name) (letter name-end)) ((D name) (letter name-end)) ((C name) (letter name-end)) ((B name) (letter name-end)) ((A name) (letter name-end)) ((@ name) (letter name-end)) ((? name) (letter name-end)) ((> name) (letter name-end)) ((= name) (letter name-end)) ((< name) (letter name-end)) ((|;| name) (letter name-end)) ((: name) (letter name-end)) ((/ name) (letter name-end)) ((. name) (letter name-end)) ((- name) (letter name-end)) ((, name) (letter name-end)) ((+ name) (letter name-end)) ((* name) (letter name-end)) ((|)| name) (letter name-end)) ((|(| name) (letter name-end)) ((|'| name) (letter name-end)) ((& name) (letter name-end)) ((% name) (letter name-end)) (($ name) (letter name-end)) ((|#| name) (letter name-end)) ((|"| name) (letter name-end)) ((! name) (letter name-end)) ((\177 name-end) (printable name-end)) ((|~| name-end) (printable name-end)) ((|}| name-end) (printable name-end)) ((|\|| name-end) (printable name-end)) ((|{| name-end) (printable name-end)) ((z name-end) (printable name-end)) ((y name-end) (printable name-end)) ((x name-end) (printable name-end)) ((w name-end) (printable name-end)) ((v name-end) (printable name-end)) ((u name-end) (printable name-end)) ((t name-end) (printable name-end)) ((s name-end) (printable name-end)) ((r name-end) (printable name-end)) ((q name-end) (printable name-end)) ((p name-end) (printable name-end)) ((o name-end) (printable name-end)) ((n name-end) (printable name-end)) ((m name-end) (printable name-end)) ((l name-end) (printable name-end)) ((k name-end) (printable name-end)) ((j name-end) (printable name-end)) ((i name-end) (printable name-end)) ((h name-end) (printable name-end)) ((g name-end) (printable name-end)) ((f name-end) (printable name-end)) ((e name-end) (printable name-end)) ((d name-end) (printable name-end)) ((c name-end) (printable name-end)) ((b name-end) (printable name-end)) ((a name-end) (printable name-end)) ((` name-end) (printable name-end)) ((_ name-end) (printable name-end)) ((^ name-end) (printable name-end)) ((|]| name-end) (printable name-end)) ((|\\| name-end) (printable name-end)) ((|[| name-end) (printable name-end)) ((Z name-end) (printable name-end)) ((Y name-end) (printable name-end)) ((X name-end) (printable name-end)) ((W name-end) (printable name-end)) ((V name-end) (printable name-end)) ((U name-end) (printable name-end)) ((T name-end) (printable name-end)) ((S name-end) (printable name-end)) ((R name-end) (printable name-end)) ((Q name-end) (printable name-end)) ((P name-end) (printable name-end)) ((O name-end) (printable name-end)) ((N name-end) (printable name-end)) ((M name-end) (printable name-end)) ((L name-end) (printable name-end)) ((K name-end) (printable name-end)) ((J name-end) (printable name-end)) ((I name-end) (printable name-end)) ((H name-end) (printable name-end)) ((G name-end) (printable name-end)) ((F name-end) (printable name-end)) ((E name-end) (printable name-end)) ((D name-end) (printable name-end)) ((C name-end) (printable name-end)) ((B name-end) (printable name-end)) ((A name-end) (printable name-end)) ((@ name-end) (printable name-end)) ((? name-end) (printable name-end)) ((> name-end) (printable name-end)) ((= name-end) (printable name-end)) ((< name-end) (printable name-end)) ((|;| name-end) (printable name-end)) ((: name-end) (printable name-end)) ((|9| name-end) (printable name-end)) ((|8| name-end) (printable name-end)) ((|7| name-end) (printable name-end)) ((|6| name-end) (printable name-end)) ((|5| name-end) (printable name-end)) ((|4| name-end) (printable name-end)) ((|3| name-end) (printable name-end)) ((|2| name-end) (printable name-end)) ((|1| name-end) (printable name-end)) ((|0| name-end) (printable name-end)) ((/ name-end) (printable name-end)) ((. name-end) (printable name-end)) ((- name-end) (printable name-end)) ((, name-end) (printable name-end)) ((+ name-end) (printable name-end)) ((* name-end) (printable name-end)) ((|)| name-end) (printable name-end)) ((|(| name-end) (printable name-end)) ((|'| name-end) (printable name-end)) ((& name-end) (printable name-end)) ((% name-end) (printable name-end)) (($ name-end) (printable name-end)) ((|#| name-end) (printable name-end)) ((|"| name-end) (printable name-end)) ((! name-end) (printable name-end)) ((|\n| name-end) ()) ((| | name-end) ()) (($ name-end) ()) ((|\n| opt-white) (white opt-white)) ((| | opt-white) (white opt-white)) ((\177 opt-white) ()) ((|~| opt-white) ()) ((|}| opt-white) ()) ((|\|| opt-white) ()) ((|{| opt-white) ()) ((z opt-white) ()) ((y opt-white) ()) ((x opt-white) ()) ((w opt-white) ()) ((v opt-white) ()) ((u opt-white) ()) ((t opt-white) ()) ((s opt-white) ()) ((r opt-white) ()) ((q opt-white) ()) ((p opt-white) ()) ((o opt-white) ()) ((n opt-white) ()) ((m opt-white) ()) ((l opt-white) ()) ((k opt-white) ()) ((j opt-white) ()) ((i opt-white) ()) ((h opt-white) ()) ((g opt-white) ()) ((f opt-white) ()) ((e opt-white) ()) ((d opt-white) ()) ((c opt-white) ()) ((b opt-white) ()) ((a opt-white) ()) ((` opt-white) ()) ((_ opt-white) ()) ((^ opt-white) ()) ((|]| opt-white) ()) ((|\\| opt-white) ()) ((|[| opt-white) ()) ((Z opt-white) ()) ((Y opt-white) ()) ((X opt-white) ()) ((W opt-white) ()) ((V opt-white) ()) ((U opt-white) ()) ((T opt-white) ()) ((S opt-white) ()) ((R opt-white) ()) ((Q opt-white) ()) ((P opt-white) ()) ((O opt-white) ()) ((N opt-white) ()) ((M opt-white) ()) ((L opt-white) ()) ((K opt-white) ()) ((J opt-white) ()) ((I opt-white) ()) ((H opt-white) ()) ((G opt-white) ()) ((F opt-white) ()) ((E opt-white) ()) ((D opt-white) ()) ((C opt-white) ()) ((B opt-white) ()) ((A opt-white) ()) ((@ opt-white) ()) ((? opt-white) ()) ((> opt-white) ()) ((= opt-white) ()) ((< opt-white) ()) ((|;| opt-white) ()) ((: opt-white) ()) ((/ opt-white) ()) ((. opt-white) ()) ((- opt-white) ()) ((, opt-white) ()) ((+ opt-white) ()) ((* opt-white) ()) ((|)| opt-white) ()) ((|(| opt-white) ()) ((|'| opt-white) ()) ((& opt-white) ()) ((% opt-white) ()) (($ opt-white) ()) ((|#| opt-white) ()) ((|"| opt-white) ()) ((! opt-white) ()) ((|9| opt-white) ()) ((|8| opt-white) ()) ((|7| opt-white) ()) ((|6| opt-white) ()) ((|5| opt-white) ()) ((|4| opt-white) ()) ((|3| opt-white) ()) ((|2| opt-white) ()) ((|1| opt-white) ()) ((|0| opt-white) ()) ((|\n| opt-white) ()) ((| | opt-white) ()) ((|\n| whites) (white opt-white)) ((| | whites) (white opt-white)) ((| | white) (| |)) ((|\n| white) (|\n|)) ((|\n| white) (|\n|)) ((! printable) (!)) ((|"| printable) (|"|)) ((|#| printable) (|#|)) (($ printable) ($)) ((% printable) (%)) ((& printable) (&)) ((|'| printable) (|'|)) ((|(| printable) (|(|)) ((|)| printable) (|)|)) ((* printable) (*)) ((+ printable) (+)) ((, printable) (,)) ((- printable) (-)) ((. printable) (.)) ((/ printable) (/)) ((|0| printable) (|0|)) ((|1| printable) (|1|)) ((|2| printable) (|2|)) ((|3| printable) (|3|)) ((|4| printable) (|4|)) ((|5| printable) (|5|)) ((|6| printable) (|6|)) ((|7| printable) (|7|)) ((|8| printable) (|8|)) ((|9| printable) (|9|)) ((: printable) (:)) ((|;| printable) (|;|)) ((< printable) (<)) ((= printable) (=)) ((> printable) (>)) ((? printable) (?)) ((@ printable) (@)) ((A printable) (A)) ((B printable) (B)) ((C printable) (C)) ((D printable) (D)) ((E printable) (E)) ((F printable) (F)) ((G printable) (G)) ((H printable) (H)) ((I printable) (I)) ((J printable) (J)) ((K printable) (K)) ((L printable) (L)) ((M printable) (M)) ((N printable) (N)) ((O printable) (O)) ((P printable) (P)) ((Q printable) (Q)) ((R printable) (R)) ((S printable) (S)) ((T printable) (T)) ((U printable) (U)) ((V printable) (V)) ((W printable) (W)) ((X printable) (X)) ((Y printable) (Y)) ((Z printable) (Z)) ((|[| printable) (|[|)) ((|\\| printable) (|\\|)) ((|]| printable) (|]|)) ((^ printable) (^)) ((_ printable) (_)) ((` printable) (`)) ((a printable) (a)) ((b printable) (b)) ((c printable) (c)) ((d printable) (d)) ((e printable) (e)) ((f printable) (f)) ((g printable) (g)) ((h printable) (h)) ((i printable) (i)) ((j printable) (j)) ((k printable) (k)) ((l printable) (l)) ((m printable) (m)) ((n printable) (n)) ((o printable) (o)) ((p printable) (p)) ((q printable) (q)) ((r printable) (r)) ((s printable) (s)) ((t printable) (t)) ((u printable) (u)) ((v printable) (v)) ((w printable) (w)) ((x printable) (x)) ((y printable) (y)) ((z printable) (z)) ((|{| printable) (|{|)) ((|\|| printable) (|\||)) ((|}| printable) (|}|)) ((|~| printable) (|~|)) ((\177 printable) (\177)) ((! letter) (!)) ((|"| letter) (|"|)) ((|#| letter) (|#|)) (($ letter) ($)) ((% letter) (%)) ((& letter) (&)) ((|'| letter) (|'|)) ((|(| letter) (|(|)) ((|)| letter) (|)|)) ((* letter) (*)) ((+ letter) (+)) ((, letter) (,)) ((- letter) (-)) ((. letter) (.)) ((/ letter) (/)) ((: letter) (:)) ((|;| letter) (|;|)) ((< letter) (<)) ((= letter) (=)) ((> letter) (>)) ((? letter) (?)) ((@ letter) (@)) ((A letter) (A)) ((B letter) (B)) ((C letter) (C)) ((D letter) (D)) ((E letter) (E)) ((F letter) (F)) ((G letter) (G)) ((H letter) (H)) ((I letter) (I)) ((J letter) (J)) ((K letter) (K)) ((L letter) (L)) ((M letter) (M)) ((N letter) (N)) ((O letter) (O)) ((P letter) (P)) ((Q letter) (Q)) ((R letter) (R)) ((S letter) (S)) ((T letter) (T)) ((U letter) (U)) ((V letter) (V)) ((W letter) (W)) ((X letter) (X)) ((Y letter) (Y)) ((Z letter) (Z)) ((|[| letter) (|[|)) ((|\\| letter) (|\\|)) ((|]| letter) (|]|)) ((^ letter) (^)) ((_ letter) (_)) ((` letter) (`)) ((a letter) (a)) ((b letter) (b)) ((c letter) (c)) ((d letter) (d)) ((e letter) (e)) ((f letter) (f)) ((g letter) (g)) ((h letter) (h)) ((i letter) (i)) ((j letter) (j)) ((k letter) (k)) ((l letter) (l)) ((m letter) (m)) ((n letter) (n)) ((o letter) (o)) ((p letter) (p)) ((q letter) (q)) ((r letter) (r)) ((s letter) (s)) ((t letter) (t)) ((u letter) (u)) ((v letter) (v)) ((w letter) (w)) ((x letter) (x)) ((y letter) (y)) ((z letter) (z)) ((|{| letter) (|{|)) ((|\|| letter) (|\||)) ((|}| letter) (|}|)) ((|~| letter) (|~|)) ((\177 letter) (\177)) ((\177 opt-header) (opt-white name whites name whites name)) ((|~| opt-header) (opt-white name whites name whites name)) ((|}| opt-header) (opt-white name whites name whites name)) ((|\|| opt-header) (opt-white name whites name whites name)) ((|{| opt-header) (opt-white name whites name whites name)) ((z opt-header) (opt-white name whites name whites name)) ((y opt-header) (opt-white name whites name whites name)) ((x opt-header) (opt-white name whites name whites name)) ((w opt-header) (opt-white name whites name whites name)) ((v opt-header) (opt-white name whites name whites name)) ((u opt-header) (opt-white name whites name whites name)) ((t opt-header) (opt-white name whites name whites name)) ((s opt-header) (opt-white name whites name whites name)) ((r opt-header) (opt-white name whites name whites name)) ((q opt-header) (opt-white name whites name whites name)) ((p opt-header) (opt-white name whites name whites name)) ((o opt-header) (opt-white name whites name whites name)) ((n opt-header) (opt-white name whites name whites name)) ((m opt-header) (opt-white name whites name whites name)) ((l opt-header) (opt-white name whites name whites name)) ((k opt-header) (opt-white name whites name whites name)) ((j opt-header) (opt-white name whites name whites name)) ((i opt-header) (opt-white name whites name whites name)) ((h opt-header) (opt-white name whites name whites name)) ((g opt-header) (opt-white name whites name whites name)) ((f opt-header) (opt-white name whites name whites name)) ((e opt-header) (opt-white name whites name whites name)) ((d opt-header) (opt-white name whites name whites name)) ((c opt-header) (opt-white name whites name whites name)) ((b opt-header) (opt-white name whites name whites name)) ((a opt-header) (opt-white name whites name whites name)) ((` opt-header) (opt-white name whites name whites name)) ((_ opt-header) (opt-white name whites name whites name)) ((^ opt-header) (opt-white name whites name whites name)) ((|]| opt-header) (opt-white name whites name whites name)) ((|\\| opt-header) (opt-white name whites name whites name)) ((|[| opt-header) (opt-white name whites name whites name)) ((Z opt-header) (opt-white name whites name whites name)) ((Y opt-header) (opt-white name whites name whites name)) ((X opt-header) (opt-white name whites name whites name)) ((W opt-header) (opt-white name whites name whites name)) ((V opt-header) (opt-white name whites name whites name)) ((U opt-header) (opt-white name whites name whites name)) ((T opt-header) (opt-white name whites name whites name)) ((S opt-header) (opt-white name whites name whites name)) ((R opt-header) (opt-white name whites name whites name)) ((Q opt-header) (opt-white name whites name whites name)) ((P opt-header) (opt-white name whites name whites name)) ((O opt-header) (opt-white name whites name whites name)) ((N opt-header) (opt-white name whites name whites name)) ((M opt-header) (opt-white name whites name whites name)) ((L opt-header) (opt-white name whites name whites name)) ((K opt-header) (opt-white name whites name whites name)) ((J opt-header) (opt-white name whites name whites name)) ((I opt-header) (opt-white name whites name whites name)) ((H opt-header) (opt-white name whites name whites name)) ((G opt-header) (opt-white name whites name whites name)) ((F opt-header) (opt-white name whites name whites name)) ((E opt-header) (opt-white name whites name whites name)) ((D opt-header) (opt-white name whites name whites name)) ((C opt-header) (opt-white name whites name whites name)) ((B opt-header) (opt-white name whites name whites name)) ((A opt-header) (opt-white name whites name whites name)) ((@ opt-header) (opt-white name whites name whites name)) ((? opt-header) (opt-white name whites name whites name)) ((> opt-header) (opt-white name whites name whites name)) ((= opt-header) (opt-white name whites name whites name)) ((< opt-header) (opt-white name whites name whites name)) ((|;| opt-header) (opt-white name whites name whites name)) ((: opt-header) (opt-white name whites name whites name)) ((/ opt-header) (opt-white name whites name whites name)) ((. opt-header) (opt-white name whites name whites name)) ((- opt-header) (opt-white name whites name whites name)) ((, opt-header) (opt-white name whites name whites name)) ((+ opt-header) (opt-white name whites name whites name)) ((* opt-header) (opt-white name whites name whites name)) ((|)| opt-header) (opt-white name whites name whites name)) ((|(| opt-header) (opt-white name whites name whites name)) ((|'| opt-header) (opt-white name whites name whites name)) ((& opt-header) (opt-white name whites name whites name)) ((% opt-header) (opt-white name whites name whites name)) (($ opt-header) (opt-white name whites name whites name)) ((|#| opt-header) (opt-white name whites name whites name)) ((|"| opt-header) (opt-white name whites name whites name)) ((! opt-header) (opt-white name whites name whites name)) ((|\n| opt-header) (opt-white name whites name whites name)) ((| | opt-header) (opt-white name whites name whites name)) ((|\n| profilesp) (whites profiles)) ((| | profilesp) (whites profiles)) ((|\n| digitsp) (more-digits)) ((| | digitsp) (more-digits)) ((|9| digitsp) (more-digits)) ((|8| digitsp) (more-digits)) ((|7| digitsp) (more-digits)) ((|6| digitsp) (more-digits)) ((|5| digitsp) (more-digits)) ((|4| digitsp) (more-digits)) ((|3| digitsp) (more-digits)) ((|2| digitsp) (more-digits)) ((|1| digitsp) (more-digits)) ((|0| digitsp) (more-digits)) ((|\n| digitsp) ()) ((| | digitsp) ()) ) lola-1.6/test/prof.log000066400000000000000000000000001414126705100147260ustar00rootroot00000000000000lola-1.6/test/resgram000077500000000000000000000047211414126705100146610ustar00rootroot00000000000000#!/usr/local/klisp ; ; resgram ; ; create a resource file from an ll parser table ; (defun cadaar (l) (car (cdr (car (car l))))) (defun production-list (table) (let ((rest)) (cond (table (setq rest (production-list (cdr table))) (cond ((member (cadar table) rest) rest ) (t (cons (cadar table) rest) ) ) ) (t nil) ) ) ) (defun enter-symbol (table value index) (set (symbol index table) value) ) (defun production-table (productions) (let ((table (new-dictionary)) (map nil) (count 0) (p)) (while productions (setq p (car productions)) (setq map (cons (list p count) map)) (while p (enter-symbol table (car p) count) (++ count) (setq p (cdr p)) ) (enter-symbol table nil count) (++ count) (setq productions (cdr productions)) ) (list table map) ) ) (defun dict-to-table (d count) (let ((s)) (setq s (lookup count d)) (cond (s (cons (eval s) (dict-to-table d (+ count 1))) ) (t nil) ) ) ) (defun print-parse-table (prod-table map table terminals non-terminals) (let ((term) (index) (table-ent)) (while non-terminals (setq term terminals) (while term (setq table-ent (assoc (list (car term) (car non-terminals)) table ) ) (patom "/* ") (print (car term)) (patom ", ") (print (car non-terminals)) (patom " */ ") (cond (table-ent (setq index (cadr (assoc (cadr table-ent) map ) ) ) (patom index ",\n") ) (t (patom -1 ",\n") ) ) (setq term (cdr term)) ) (setq non-terminals (cdr non-terminals)) ) ) ) (defun process-file (file-in) (setq parse-dictionary (new-dictionary)) (setq terminals (fread-dictionary file-in parse-dictionary)) (setq non-terminals (fread-dictionary file-in parse-dictionary)) (setq table (fread-dictionary file-in parse-dictionary)) (setq list-of-productions (production-list table)) (setq start-symbol (cadaar table)) (setq temp (production-table list-of-productions)) (setq map (cadr temp)) (setq prod-table (dict-to-table (car temp) 0)) (print terminals) (print non-terminals) (print-parse-table prod-table map table terminals non-terminals) (print prod-table) ) (setq file-in stdin) (if argv (setq file-in (fopen (car argv) 'r)) (if (null file-in) (error (strcat "parser: can't open " (sprint (car argv)))) ) ) (process-file file-in) (fclose file-in) lola-1.6/test/tekgram000066400000000000000000000042131414126705100146440ustar00rootroot00000000000000; ; 4012 grammar at the character level ; ( (alpha ("PRINT" printable alpha) (|\033| |\014| "CLEAR" alpha) (|\r| "CR" alpha) (|\n| "LF" alpha) (|\t| "HT" alpha) (|\b| "BS" alpha) (|\013| "VT" alpha) (graph alpha) ) (graph (|\035| line graph) (|\035| line exit-graph) ) (exit-graph (|\037|) (|\033| |\014| "CLEAR") (|\r| "CR") ) (line (move draws) () ) (move (coord "MOVE") ) (draws (draw draws) () ) (draw (coord "DRAW") ) (coord (HIADDR LOY HIADDR LOX "fourAddr") (LOY HIADDR LOX "threeAddr") (HIADDR LOX "twoAddr") (LOY LOX "loLoAddr") (LOX "oneAddr") ) (HIADDR (|\40|) (|\41|) (|\42|) (|\43|) (|\44|) (|\45|) (|\46|) (|\47|) (|\50|) (|\51|) (|\52|) (|\53|) (|\54|) (|\55|) (|\56|) (|\57|) (|\60|) (|\61|) (|\62|) (|\63|) (|\64|) (|\65|) (|\66|) (|\67|) (|\70|) (|\71|) (|\72|) (|\73|) (|\74|) (|\75|) (|\76|) (|\77|) ) (LOY (|\140|) (|\141|) (|\142|) (|\143|) (|\144|) (|\145|) (|\146|) (|\147|) (|\150|) (|\151|) (|\152|) (|\153|) (|\154|) (|\155|) (|\156|) (|\157|) (|\160|) (|\161|) (|\162|) (|\163|) (|\164|) (|\165|) (|\166|) (|\167|) (|\170|) (|\171|) (|\172|) (|\173|) (|\174|) (|\175|) (|\176|) (|\177|) ) (LOX (|\100|) (|\101|) (|\102|) (|\103|) (|\104|) (|\105|) (|\106|) (|\107|) (|\110|) (|\111|) (|\112|) (|\113|) (|\114|) (|\115|) (|\116|) (|\117|) (|\120|) (|\121|) (|\122|) (|\123|) (|\124|) (|\125|) (|\126|) (|\127|) (|\130|) (|\131|) (|\132|) (|\133|) (|\134|) (|\135|) (|\136|) (|\137|) ) (printable (| |) (|!|) (|"|) (|#|) (|$|) (|%|) (|&|) (|'|) (|(|) (|)|) (|*|) (|+|) (|,|) (|-|) (|.|) (|/|) (|0|) (|1|) (|2|) (|3|) (|4|) (|5|) (|6|) (|7|) (|8|) (|9|) (|:|) (|;|) (|<|) (|=|) (|>|) (|?|) (|@|) (|A|) (|B|) (|C|) (|D|) (|E|) (|F|) (|G|) (|H|) (|I|) (|J|) (|K|) (|L|) (|M|) (|N|) (|O|) (|P|) (|Q|) (|R|) (|S|) (|T|) (|U|) (|V|) (|W|) (|X|) (|Y|) (|Z|) (|[|) (|\\|) (|]|) (|^|) (|_|) (|`|) (|a|) (|b|) (|c|) (|d|) (|e|) (|f|) (|g|) (|h|) (|i|) (|j|) (|k|) (|l|) (|m|) (|n|) (|o|) (|p|) (|q|) (|r|) (|s|) (|t|) (|u|) (|v|) (|w|) (|x|) (|y|) (|z|) (|{|) (|\||) (|}|) (|~|) (|\177|) ) ) lola-1.6/test/tekgram.g000066400000000000000000000614661414126705100151060ustar00rootroot00000000000000(|\013| \035 |\n| \033 \037 \177 |~| |}| |\|| |{| z y x w v u t s r q p o n m l k j i h g f e d c b a ` ? > = < |;| : |9| |8| |7| |6| |5| |4| |3| |2| |1| |0| / . - , + * |)| |(| |'| & % $ |#| |"| ! | | _ ^ |]| |\\| |[| Z Y X W V U T S R Q P O N M L K J I H G F E D C B A @) (alpha graph exit-graph line move draws draw coord HIADDR LOY LOX printable graphp coordp coordpp) ( ((\177 alpha) (printable "PRINT" alpha)) ((|~| alpha) (printable "PRINT" alpha)) ((|}| alpha) (printable "PRINT" alpha)) ((|\|| alpha) (printable "PRINT" alpha)) ((|{| alpha) (printable "PRINT" alpha)) ((z alpha) (printable "PRINT" alpha)) ((y alpha) (printable "PRINT" alpha)) ((x alpha) (printable "PRINT" alpha)) ((w alpha) (printable "PRINT" alpha)) ((v alpha) (printable "PRINT" alpha)) ((u alpha) (printable "PRINT" alpha)) ((t alpha) (printable "PRINT" alpha)) ((s alpha) (printable "PRINT" alpha)) ((r alpha) (printable "PRINT" alpha)) ((q alpha) (printable "PRINT" alpha)) ((p alpha) (printable "PRINT" alpha)) ((o alpha) (printable "PRINT" alpha)) ((n alpha) (printable "PRINT" alpha)) ((m alpha) (printable "PRINT" alpha)) ((l alpha) (printable "PRINT" alpha)) ((k alpha) (printable "PRINT" alpha)) ((j alpha) (printable "PRINT" alpha)) ((i alpha) (printable "PRINT" alpha)) ((h alpha) (printable "PRINT" alpha)) ((g alpha) (printable "PRINT" alpha)) ((f alpha) (printable "PRINT" alpha)) ((e alpha) (printable "PRINT" alpha)) ((d alpha) (printable "PRINT" alpha)) ((c alpha) (printable "PRINT" alpha)) ((b alpha) (printable "PRINT" alpha)) ((a alpha) (printable "PRINT" alpha)) ((` alpha) (printable "PRINT" alpha)) ((_ alpha) (printable "PRINT" alpha)) ((^ alpha) (printable "PRINT" alpha)) ((|]| alpha) (printable "PRINT" alpha)) ((|\\| alpha) (printable "PRINT" alpha)) ((|[| alpha) (printable "PRINT" alpha)) ((Z alpha) (printable "PRINT" alpha)) ((Y alpha) (printable "PRINT" alpha)) ((X alpha) (printable "PRINT" alpha)) ((W alpha) (printable "PRINT" alpha)) ((V alpha) (printable "PRINT" alpha)) ((U alpha) (printable "PRINT" alpha)) ((T alpha) (printable "PRINT" alpha)) ((S alpha) (printable "PRINT" alpha)) ((R alpha) (printable "PRINT" alpha)) ((Q alpha) (printable "PRINT" alpha)) ((P alpha) (printable "PRINT" alpha)) ((O alpha) (printable "PRINT" alpha)) ((N alpha) (printable "PRINT" alpha)) ((M alpha) (printable "PRINT" alpha)) ((L alpha) (printable "PRINT" alpha)) ((K alpha) (printable "PRINT" alpha)) ((J alpha) (printable "PRINT" alpha)) ((I alpha) (printable "PRINT" alpha)) ((H alpha) (printable "PRINT" alpha)) ((G alpha) (printable "PRINT" alpha)) ((F alpha) (printable "PRINT" alpha)) ((E alpha) (printable "PRINT" alpha)) ((D alpha) (printable "PRINT" alpha)) ((C alpha) (printable "PRINT" alpha)) ((B alpha) (printable "PRINT" alpha)) ((A alpha) (printable "PRINT" alpha)) ((@ alpha) (printable "PRINT" alpha)) ((? alpha) (printable "PRINT" alpha)) ((> alpha) (printable "PRINT" alpha)) ((= alpha) (printable "PRINT" alpha)) ((< alpha) (printable "PRINT" alpha)) ((|;| alpha) (printable "PRINT" alpha)) ((: alpha) (printable "PRINT" alpha)) ((|9| alpha) (printable "PRINT" alpha)) ((|8| alpha) (printable "PRINT" alpha)) ((|7| alpha) (printable "PRINT" alpha)) ((|6| alpha) (printable "PRINT" alpha)) ((|5| alpha) (printable "PRINT" alpha)) ((|4| alpha) (printable "PRINT" alpha)) ((|3| alpha) (printable "PRINT" alpha)) ((|2| alpha) (printable "PRINT" alpha)) ((|1| alpha) (printable "PRINT" alpha)) ((|0| alpha) (printable "PRINT" alpha)) ((/ alpha) (printable "PRINT" alpha)) ((. alpha) (printable "PRINT" alpha)) ((- alpha) (printable "PRINT" alpha)) ((, alpha) (printable "PRINT" alpha)) ((+ alpha) (printable "PRINT" alpha)) ((* alpha) (printable "PRINT" alpha)) ((|)| alpha) (printable "PRINT" alpha)) ((|(| alpha) (printable "PRINT" alpha)) ((|'| alpha) (printable "PRINT" alpha)) ((& alpha) (printable "PRINT" alpha)) ((% alpha) (printable "PRINT" alpha)) (($ alpha) (printable "PRINT" alpha)) ((|#| alpha) (printable "PRINT" alpha)) ((|"| alpha) (printable "PRINT" alpha)) ((! alpha) (printable "PRINT" alpha)) ((| | alpha) (printable "PRINT" alpha)) ((\033 alpha) (\033 |\n| "CLEAR" alpha)) ((|\n| alpha) (|\n| "CR" alpha)) ((|\n| alpha) (|\n| "LF" alpha)) ((|\n| alpha) (|\n| "HT" alpha)) ((|\n| alpha) (|\n| "BS" alpha)) ((|\013| alpha) (|\013| "VT" alpha)) ((\035 alpha) (graph alpha)) ((\035 graph) (\035 line graphp)) ((\037 exit-graph) (\037)) ((\033 exit-graph) (\033 |\n| "CLEAR")) ((|\n| exit-graph) (|\n| "CR")) ((_ line) (move draws)) ((^ line) (move draws)) ((|]| line) (move draws)) ((|\\| line) (move draws)) ((|[| line) (move draws)) ((Z line) (move draws)) ((Y line) (move draws)) ((X line) (move draws)) ((W line) (move draws)) ((V line) (move draws)) ((U line) (move draws)) ((T line) (move draws)) ((S line) (move draws)) ((R line) (move draws)) ((Q line) (move draws)) ((P line) (move draws)) ((O line) (move draws)) ((N line) (move draws)) ((M line) (move draws)) ((L line) (move draws)) ((K line) (move draws)) ((J line) (move draws)) ((I line) (move draws)) ((H line) (move draws)) ((G line) (move draws)) ((F line) (move draws)) ((E line) (move draws)) ((D line) (move draws)) ((C line) (move draws)) ((B line) (move draws)) ((A line) (move draws)) ((@ line) (move draws)) ((? line) (move draws)) ((> line) (move draws)) ((= line) (move draws)) ((< line) (move draws)) ((|;| line) (move draws)) ((: line) (move draws)) ((|9| line) (move draws)) ((|8| line) (move draws)) ((|7| line) (move draws)) ((|6| line) (move draws)) ((|5| line) (move draws)) ((|4| line) (move draws)) ((|3| line) (move draws)) ((|2| line) (move draws)) ((|1| line) (move draws)) ((|0| line) (move draws)) ((/ line) (move draws)) ((. line) (move draws)) ((- line) (move draws)) ((, line) (move draws)) ((+ line) (move draws)) ((* line) (move draws)) ((|)| line) (move draws)) ((|(| line) (move draws)) ((|'| line) (move draws)) ((& line) (move draws)) ((% line) (move draws)) (($ line) (move draws)) ((|#| line) (move draws)) ((|"| line) (move draws)) ((! line) (move draws)) ((| | line) (move draws)) ((\177 line) (move draws)) ((|~| line) (move draws)) ((|}| line) (move draws)) ((|\|| line) (move draws)) ((|{| line) (move draws)) ((z line) (move draws)) ((y line) (move draws)) ((x line) (move draws)) ((w line) (move draws)) ((v line) (move draws)) ((u line) (move draws)) ((t line) (move draws)) ((s line) (move draws)) ((r line) (move draws)) ((q line) (move draws)) ((p line) (move draws)) ((o line) (move draws)) ((n line) (move draws)) ((m line) (move draws)) ((l line) (move draws)) ((k line) (move draws)) ((j line) (move draws)) ((i line) (move draws)) ((h line) (move draws)) ((g line) (move draws)) ((f line) (move draws)) ((e line) (move draws)) ((d line) (move draws)) ((c line) (move draws)) ((b line) (move draws)) ((a line) (move draws)) ((` line) (move draws)) ((|\n| line) ()) ((\033 line) ()) ((\037 line) ()) ((\035 line) ()) ((_ move) (coord "MOVE")) ((^ move) (coord "MOVE")) ((|]| move) (coord "MOVE")) ((|\\| move) (coord "MOVE")) ((|[| move) (coord "MOVE")) ((Z move) (coord "MOVE")) ((Y move) (coord "MOVE")) ((X move) (coord "MOVE")) ((W move) (coord "MOVE")) ((V move) (coord "MOVE")) ((U move) (coord "MOVE")) ((T move) (coord "MOVE")) ((S move) (coord "MOVE")) ((R move) (coord "MOVE")) ((Q move) (coord "MOVE")) ((P move) (coord "MOVE")) ((O move) (coord "MOVE")) ((N move) (coord "MOVE")) ((M move) (coord "MOVE")) ((L move) (coord "MOVE")) ((K move) (coord "MOVE")) ((J move) (coord "MOVE")) ((I move) (coord "MOVE")) ((H move) (coord "MOVE")) ((G move) (coord "MOVE")) ((F move) (coord "MOVE")) ((E move) (coord "MOVE")) ((D move) (coord "MOVE")) ((C move) (coord "MOVE")) ((B move) (coord "MOVE")) ((A move) (coord "MOVE")) ((@ move) (coord "MOVE")) ((? move) (coord "MOVE")) ((> move) (coord "MOVE")) ((= move) (coord "MOVE")) ((< move) (coord "MOVE")) ((|;| move) (coord "MOVE")) ((: move) (coord "MOVE")) ((|9| move) (coord "MOVE")) ((|8| move) (coord "MOVE")) ((|7| move) (coord "MOVE")) ((|6| move) (coord "MOVE")) ((|5| move) (coord "MOVE")) ((|4| move) (coord "MOVE")) ((|3| move) (coord "MOVE")) ((|2| move) (coord "MOVE")) ((|1| move) (coord "MOVE")) ((|0| move) (coord "MOVE")) ((/ move) (coord "MOVE")) ((. move) (coord "MOVE")) ((- move) (coord "MOVE")) ((, move) (coord "MOVE")) ((+ move) (coord "MOVE")) ((* move) (coord "MOVE")) ((|)| move) (coord "MOVE")) ((|(| move) (coord "MOVE")) ((|'| move) (coord "MOVE")) ((& move) (coord "MOVE")) ((% move) (coord "MOVE")) (($ move) (coord "MOVE")) ((|#| move) (coord "MOVE")) ((|"| move) (coord "MOVE")) ((! move) (coord "MOVE")) ((| | move) (coord "MOVE")) ((\177 move) (coord "MOVE")) ((|~| move) (coord "MOVE")) ((|}| move) (coord "MOVE")) ((|\|| move) (coord "MOVE")) ((|{| move) (coord "MOVE")) ((z move) (coord "MOVE")) ((y move) (coord "MOVE")) ((x move) (coord "MOVE")) ((w move) (coord "MOVE")) ((v move) (coord "MOVE")) ((u move) (coord "MOVE")) ((t move) (coord "MOVE")) ((s move) (coord "MOVE")) ((r move) (coord "MOVE")) ((q move) (coord "MOVE")) ((p move) (coord "MOVE")) ((o move) (coord "MOVE")) ((n move) (coord "MOVE")) ((m move) (coord "MOVE")) ((l move) (coord "MOVE")) ((k move) (coord "MOVE")) ((j move) (coord "MOVE")) ((i move) (coord "MOVE")) ((h move) (coord "MOVE")) ((g move) (coord "MOVE")) ((f move) (coord "MOVE")) ((e move) (coord "MOVE")) ((d move) (coord "MOVE")) ((c move) (coord "MOVE")) ((b move) (coord "MOVE")) ((a move) (coord "MOVE")) ((` move) (coord "MOVE")) ((_ draws) (draw draws)) ((^ draws) (draw draws)) ((|]| draws) (draw draws)) ((|\\| draws) (draw draws)) ((|[| draws) (draw draws)) ((Z draws) (draw draws)) ((Y draws) (draw draws)) ((X draws) (draw draws)) ((W draws) (draw draws)) ((V draws) (draw draws)) ((U draws) (draw draws)) ((T draws) (draw draws)) ((S draws) (draw draws)) ((R draws) (draw draws)) ((Q draws) (draw draws)) ((P draws) (draw draws)) ((O draws) (draw draws)) ((N draws) (draw draws)) ((M draws) (draw draws)) ((L draws) (draw draws)) ((K draws) (draw draws)) ((J draws) (draw draws)) ((I draws) (draw draws)) ((H draws) (draw draws)) ((G draws) (draw draws)) ((F draws) (draw draws)) ((E draws) (draw draws)) ((D draws) (draw draws)) ((C draws) (draw draws)) ((B draws) (draw draws)) ((A draws) (draw draws)) ((@ draws) (draw draws)) ((? draws) (draw draws)) ((> draws) (draw draws)) ((= draws) (draw draws)) ((< draws) (draw draws)) ((|;| draws) (draw draws)) ((: draws) (draw draws)) ((|9| draws) (draw draws)) ((|8| draws) (draw draws)) ((|7| draws) (draw draws)) ((|6| draws) (draw draws)) ((|5| draws) (draw draws)) ((|4| draws) (draw draws)) ((|3| draws) (draw draws)) ((|2| draws) (draw draws)) ((|1| draws) (draw draws)) ((|0| draws) (draw draws)) ((/ draws) (draw draws)) ((. draws) (draw draws)) ((- draws) (draw draws)) ((, draws) (draw draws)) ((+ draws) (draw draws)) ((* draws) (draw draws)) ((|)| draws) (draw draws)) ((|(| draws) (draw draws)) ((|'| draws) (draw draws)) ((& draws) (draw draws)) ((% draws) (draw draws)) (($ draws) (draw draws)) ((|#| draws) (draw draws)) ((|"| draws) (draw draws)) ((! draws) (draw draws)) ((| | draws) (draw draws)) ((\177 draws) (draw draws)) ((|~| draws) (draw draws)) ((|}| draws) (draw draws)) ((|\|| draws) (draw draws)) ((|{| draws) (draw draws)) ((z draws) (draw draws)) ((y draws) (draw draws)) ((x draws) (draw draws)) ((w draws) (draw draws)) ((v draws) (draw draws)) ((u draws) (draw draws)) ((t draws) (draw draws)) ((s draws) (draw draws)) ((r draws) (draw draws)) ((q draws) (draw draws)) ((p draws) (draw draws)) ((o draws) (draw draws)) ((n draws) (draw draws)) ((m draws) (draw draws)) ((l draws) (draw draws)) ((k draws) (draw draws)) ((j draws) (draw draws)) ((i draws) (draw draws)) ((h draws) (draw draws)) ((g draws) (draw draws)) ((f draws) (draw draws)) ((e draws) (draw draws)) ((d draws) (draw draws)) ((c draws) (draw draws)) ((b draws) (draw draws)) ((a draws) (draw draws)) ((` draws) (draw draws)) ((|\n| draws) ()) ((\033 draws) ()) ((\037 draws) ()) ((\035 draws) ()) ((_ draw) (coord "DRAW")) ((^ draw) (coord "DRAW")) ((|]| draw) (coord "DRAW")) ((|\\| draw) (coord "DRAW")) ((|[| draw) (coord "DRAW")) ((Z draw) (coord "DRAW")) ((Y draw) (coord "DRAW")) ((X draw) (coord "DRAW")) ((W draw) (coord "DRAW")) ((V draw) (coord "DRAW")) ((U draw) (coord "DRAW")) ((T draw) (coord "DRAW")) ((S draw) (coord "DRAW")) ((R draw) (coord "DRAW")) ((Q draw) (coord "DRAW")) ((P draw) (coord "DRAW")) ((O draw) (coord "DRAW")) ((N draw) (coord "DRAW")) ((M draw) (coord "DRAW")) ((L draw) (coord "DRAW")) ((K draw) (coord "DRAW")) ((J draw) (coord "DRAW")) ((I draw) (coord "DRAW")) ((H draw) (coord "DRAW")) ((G draw) (coord "DRAW")) ((F draw) (coord "DRAW")) ((E draw) (coord "DRAW")) ((D draw) (coord "DRAW")) ((C draw) (coord "DRAW")) ((B draw) (coord "DRAW")) ((A draw) (coord "DRAW")) ((@ draw) (coord "DRAW")) ((? draw) (coord "DRAW")) ((> draw) (coord "DRAW")) ((= draw) (coord "DRAW")) ((< draw) (coord "DRAW")) ((|;| draw) (coord "DRAW")) ((: draw) (coord "DRAW")) ((|9| draw) (coord "DRAW")) ((|8| draw) (coord "DRAW")) ((|7| draw) (coord "DRAW")) ((|6| draw) (coord "DRAW")) ((|5| draw) (coord "DRAW")) ((|4| draw) (coord "DRAW")) ((|3| draw) (coord "DRAW")) ((|2| draw) (coord "DRAW")) ((|1| draw) (coord "DRAW")) ((|0| draw) (coord "DRAW")) ((/ draw) (coord "DRAW")) ((. draw) (coord "DRAW")) ((- draw) (coord "DRAW")) ((, draw) (coord "DRAW")) ((+ draw) (coord "DRAW")) ((* draw) (coord "DRAW")) ((|)| draw) (coord "DRAW")) ((|(| draw) (coord "DRAW")) ((|'| draw) (coord "DRAW")) ((& draw) (coord "DRAW")) ((% draw) (coord "DRAW")) (($ draw) (coord "DRAW")) ((|#| draw) (coord "DRAW")) ((|"| draw) (coord "DRAW")) ((! draw) (coord "DRAW")) ((| | draw) (coord "DRAW")) ((\177 draw) (coord "DRAW")) ((|~| draw) (coord "DRAW")) ((|}| draw) (coord "DRAW")) ((|\|| draw) (coord "DRAW")) ((|{| draw) (coord "DRAW")) ((z draw) (coord "DRAW")) ((y draw) (coord "DRAW")) ((x draw) (coord "DRAW")) ((w draw) (coord "DRAW")) ((v draw) (coord "DRAW")) ((u draw) (coord "DRAW")) ((t draw) (coord "DRAW")) ((s draw) (coord "DRAW")) ((r draw) (coord "DRAW")) ((q draw) (coord "DRAW")) ((p draw) (coord "DRAW")) ((o draw) (coord "DRAW")) ((n draw) (coord "DRAW")) ((m draw) (coord "DRAW")) ((l draw) (coord "DRAW")) ((k draw) (coord "DRAW")) ((j draw) (coord "DRAW")) ((i draw) (coord "DRAW")) ((h draw) (coord "DRAW")) ((g draw) (coord "DRAW")) ((f draw) (coord "DRAW")) ((e draw) (coord "DRAW")) ((d draw) (coord "DRAW")) ((c draw) (coord "DRAW")) ((b draw) (coord "DRAW")) ((a draw) (coord "DRAW")) ((` draw) (coord "DRAW")) ((\177 coord) (LOY coordpp)) ((|~| coord) (LOY coordpp)) ((|}| coord) (LOY coordpp)) ((|\|| coord) (LOY coordpp)) ((|{| coord) (LOY coordpp)) ((z coord) (LOY coordpp)) ((y coord) (LOY coordpp)) ((x coord) (LOY coordpp)) ((w coord) (LOY coordpp)) ((v coord) (LOY coordpp)) ((u coord) (LOY coordpp)) ((t coord) (LOY coordpp)) ((s coord) (LOY coordpp)) ((r coord) (LOY coordpp)) ((q coord) (LOY coordpp)) ((p coord) (LOY coordpp)) ((o coord) (LOY coordpp)) ((n coord) (LOY coordpp)) ((m coord) (LOY coordpp)) ((l coord) (LOY coordpp)) ((k coord) (LOY coordpp)) ((j coord) (LOY coordpp)) ((i coord) (LOY coordpp)) ((h coord) (LOY coordpp)) ((g coord) (LOY coordpp)) ((f coord) (LOY coordpp)) ((e coord) (LOY coordpp)) ((d coord) (LOY coordpp)) ((c coord) (LOY coordpp)) ((b coord) (LOY coordpp)) ((a coord) (LOY coordpp)) ((` coord) (LOY coordpp)) ((? coord) (HIADDR coordp)) ((> coord) (HIADDR coordp)) ((= coord) (HIADDR coordp)) ((< coord) (HIADDR coordp)) ((|;| coord) (HIADDR coordp)) ((: coord) (HIADDR coordp)) ((|9| coord) (HIADDR coordp)) ((|8| coord) (HIADDR coordp)) ((|7| coord) (HIADDR coordp)) ((|6| coord) (HIADDR coordp)) ((|5| coord) (HIADDR coordp)) ((|4| coord) (HIADDR coordp)) ((|3| coord) (HIADDR coordp)) ((|2| coord) (HIADDR coordp)) ((|1| coord) (HIADDR coordp)) ((|0| coord) (HIADDR coordp)) ((/ coord) (HIADDR coordp)) ((. coord) (HIADDR coordp)) ((- coord) (HIADDR coordp)) ((, coord) (HIADDR coordp)) ((+ coord) (HIADDR coordp)) ((* coord) (HIADDR coordp)) ((|)| coord) (HIADDR coordp)) ((|(| coord) (HIADDR coordp)) ((|'| coord) (HIADDR coordp)) ((& coord) (HIADDR coordp)) ((% coord) (HIADDR coordp)) (($ coord) (HIADDR coordp)) ((|#| coord) (HIADDR coordp)) ((|"| coord) (HIADDR coordp)) ((! coord) (HIADDR coordp)) ((| | coord) (HIADDR coordp)) ((_ coord) (LOX "oneAddr")) ((^ coord) (LOX "oneAddr")) ((|]| coord) (LOX "oneAddr")) ((|\\| coord) (LOX "oneAddr")) ((|[| coord) (LOX "oneAddr")) ((Z coord) (LOX "oneAddr")) ((Y coord) (LOX "oneAddr")) ((X coord) (LOX "oneAddr")) ((W coord) (LOX "oneAddr")) ((V coord) (LOX "oneAddr")) ((U coord) (LOX "oneAddr")) ((T coord) (LOX "oneAddr")) ((S coord) (LOX "oneAddr")) ((R coord) (LOX "oneAddr")) ((Q coord) (LOX "oneAddr")) ((P coord) (LOX "oneAddr")) ((O coord) (LOX "oneAddr")) ((N coord) (LOX "oneAddr")) ((M coord) (LOX "oneAddr")) ((L coord) (LOX "oneAddr")) ((K coord) (LOX "oneAddr")) ((J coord) (LOX "oneAddr")) ((I coord) (LOX "oneAddr")) ((H coord) (LOX "oneAddr")) ((G coord) (LOX "oneAddr")) ((F coord) (LOX "oneAddr")) ((E coord) (LOX "oneAddr")) ((D coord) (LOX "oneAddr")) ((C coord) (LOX "oneAddr")) ((B coord) (LOX "oneAddr")) ((A coord) (LOX "oneAddr")) ((@ coord) (LOX "oneAddr")) ((| | HIADDR) (| |)) ((! HIADDR) (!)) ((|"| HIADDR) (|"|)) ((|#| HIADDR) (|#|)) (($ HIADDR) ($)) ((% HIADDR) (%)) ((& HIADDR) (&)) ((|'| HIADDR) (|'|)) ((|(| HIADDR) (|(|)) ((|)| HIADDR) (|)|)) ((* HIADDR) (*)) ((+ HIADDR) (+)) ((, HIADDR) (,)) ((- HIADDR) (-)) ((. HIADDR) (.)) ((/ HIADDR) (/)) ((|0| HIADDR) (|0|)) ((|1| HIADDR) (|1|)) ((|2| HIADDR) (|2|)) ((|3| HIADDR) (|3|)) ((|4| HIADDR) (|4|)) ((|5| HIADDR) (|5|)) ((|6| HIADDR) (|6|)) ((|7| HIADDR) (|7|)) ((|8| HIADDR) (|8|)) ((|9| HIADDR) (|9|)) ((: HIADDR) (:)) ((|;| HIADDR) (|;|)) ((< HIADDR) (<)) ((= HIADDR) (=)) ((> HIADDR) (>)) ((? HIADDR) (?)) ((` LOY) (`)) ((a LOY) (a)) ((b LOY) (b)) ((c LOY) (c)) ((d LOY) (d)) ((e LOY) (e)) ((f LOY) (f)) ((g LOY) (g)) ((h LOY) (h)) ((i LOY) (i)) ((j LOY) (j)) ((k LOY) (k)) ((l LOY) (l)) ((m LOY) (m)) ((n LOY) (n)) ((o LOY) (o)) ((p LOY) (p)) ((q LOY) (q)) ((r LOY) (r)) ((s LOY) (s)) ((t LOY) (t)) ((u LOY) (u)) ((v LOY) (v)) ((w LOY) (w)) ((x LOY) (x)) ((y LOY) (y)) ((z LOY) (z)) ((|{| LOY) (|{|)) ((|\|| LOY) (|\||)) ((|}| LOY) (|}|)) ((|~| LOY) (|~|)) ((\177 LOY) (\177)) ((@ LOX) (@)) ((A LOX) (A)) ((B LOX) (B)) ((C LOX) (C)) ((D LOX) (D)) ((E LOX) (E)) ((F LOX) (F)) ((G LOX) (G)) ((H LOX) (H)) ((I LOX) (I)) ((J LOX) (J)) ((K LOX) (K)) ((L LOX) (L)) ((M LOX) (M)) ((N LOX) (N)) ((O LOX) (O)) ((P LOX) (P)) ((Q LOX) (Q)) ((R LOX) (R)) ((S LOX) (S)) ((T LOX) (T)) ((U LOX) (U)) ((V LOX) (V)) ((W LOX) (W)) ((X LOX) (X)) ((Y LOX) (Y)) ((Z LOX) (Z)) ((|[| LOX) (|[|)) ((|\\| LOX) (|\\|)) ((|]| LOX) (|]|)) ((^ LOX) (^)) ((_ LOX) (_)) ((| | printable) (| |)) ((! printable) (!)) ((|"| printable) (|"|)) ((|#| printable) (|#|)) (($ printable) ($)) ((% printable) (%)) ((& printable) (&)) ((|'| printable) (|'|)) ((|(| printable) (|(|)) ((|)| printable) (|)|)) ((* printable) (*)) ((+ printable) (+)) ((, printable) (,)) ((- printable) (-)) ((. printable) (.)) ((/ printable) (/)) ((|0| printable) (|0|)) ((|1| printable) (|1|)) ((|2| printable) (|2|)) ((|3| printable) (|3|)) ((|4| printable) (|4|)) ((|5| printable) (|5|)) ((|6| printable) (|6|)) ((|7| printable) (|7|)) ((|8| printable) (|8|)) ((|9| printable) (|9|)) ((: printable) (:)) ((|;| printable) (|;|)) ((< printable) (<)) ((= printable) (=)) ((> printable) (>)) ((? printable) (?)) ((@ printable) (@)) ((A printable) (A)) ((B printable) (B)) ((C printable) (C)) ((D printable) (D)) ((E printable) (E)) ((F printable) (F)) ((G printable) (G)) ((H printable) (H)) ((I printable) (I)) ((J printable) (J)) ((K printable) (K)) ((L printable) (L)) ((M printable) (M)) ((N printable) (N)) ((O printable) (O)) ((P printable) (P)) ((Q printable) (Q)) ((R printable) (R)) ((S printable) (S)) ((T printable) (T)) ((U printable) (U)) ((V printable) (V)) ((W printable) (W)) ((X printable) (X)) ((Y printable) (Y)) ((Z printable) (Z)) ((|[| printable) (|[|)) ((|\\| printable) (|\\|)) ((|]| printable) (|]|)) ((^ printable) (^)) ((_ printable) (_)) ((` printable) (`)) ((a printable) (a)) ((b printable) (b)) ((c printable) (c)) ((d printable) (d)) ((e printable) (e)) ((f printable) (f)) ((g printable) (g)) ((h printable) (h)) ((i printable) (i)) ((j printable) (j)) ((k printable) (k)) ((l printable) (l)) ((m printable) (m)) ((n printable) (n)) ((o printable) (o)) ((p printable) (p)) ((q printable) (q)) ((r printable) (r)) ((s printable) (s)) ((t printable) (t)) ((u printable) (u)) ((v printable) (v)) ((w printable) (w)) ((x printable) (x)) ((y printable) (y)) ((z printable) (z)) ((|{| printable) (|{|)) ((|\|| printable) (|\||)) ((|}| printable) (|}|)) ((|~| printable) (|~|)) ((\177 printable) (\177)) ((\035 graphp) (graph)) ((|\n| graphp) (exit-graph)) ((\033 graphp) (exit-graph)) ((\037 graphp) (exit-graph)) ((\177 coordp) (LOY HIADDR LOX "fourAddr")) ((|~| coordp) (LOY HIADDR LOX "fourAddr")) ((|}| coordp) (LOY HIADDR LOX "fourAddr")) ((|\|| coordp) (LOY HIADDR LOX "fourAddr")) ((|{| coordp) (LOY HIADDR LOX "fourAddr")) ((z coordp) (LOY HIADDR LOX "fourAddr")) ((y coordp) (LOY HIADDR LOX "fourAddr")) ((x coordp) (LOY HIADDR LOX "fourAddr")) ((w coordp) (LOY HIADDR LOX "fourAddr")) ((v coordp) (LOY HIADDR LOX "fourAddr")) ((u coordp) (LOY HIADDR LOX "fourAddr")) ((t coordp) (LOY HIADDR LOX "fourAddr")) ((s coordp) (LOY HIADDR LOX "fourAddr")) ((r coordp) (LOY HIADDR LOX "fourAddr")) ((q coordp) (LOY HIADDR LOX "fourAddr")) ((p coordp) (LOY HIADDR LOX "fourAddr")) ((o coordp) (LOY HIADDR LOX "fourAddr")) ((n coordp) (LOY HIADDR LOX "fourAddr")) ((m coordp) (LOY HIADDR LOX "fourAddr")) ((l coordp) (LOY HIADDR LOX "fourAddr")) ((k coordp) (LOY HIADDR LOX "fourAddr")) ((j coordp) (LOY HIADDR LOX "fourAddr")) ((i coordp) (LOY HIADDR LOX "fourAddr")) ((h coordp) (LOY HIADDR LOX "fourAddr")) ((g coordp) (LOY HIADDR LOX "fourAddr")) ((f coordp) (LOY HIADDR LOX "fourAddr")) ((e coordp) (LOY HIADDR LOX "fourAddr")) ((d coordp) (LOY HIADDR LOX "fourAddr")) ((c coordp) (LOY HIADDR LOX "fourAddr")) ((b coordp) (LOY HIADDR LOX "fourAddr")) ((a coordp) (LOY HIADDR LOX "fourAddr")) ((` coordp) (LOY HIADDR LOX "fourAddr")) ((_ coordp) (LOX "twoAddr")) ((^ coordp) (LOX "twoAddr")) ((|]| coordp) (LOX "twoAddr")) ((|\\| coordp) (LOX "twoAddr")) ((|[| coordp) (LOX "twoAddr")) ((Z coordp) (LOX "twoAddr")) ((Y coordp) (LOX "twoAddr")) ((X coordp) (LOX "twoAddr")) ((W coordp) (LOX "twoAddr")) ((V coordp) (LOX "twoAddr")) ((U coordp) (LOX "twoAddr")) ((T coordp) (LOX "twoAddr")) ((S coordp) (LOX "twoAddr")) ((R coordp) (LOX "twoAddr")) ((Q coordp) (LOX "twoAddr")) ((P coordp) (LOX "twoAddr")) ((O coordp) (LOX "twoAddr")) ((N coordp) (LOX "twoAddr")) ((M coordp) (LOX "twoAddr")) ((L coordp) (LOX "twoAddr")) ((K coordp) (LOX "twoAddr")) ((J coordp) (LOX "twoAddr")) ((I coordp) (LOX "twoAddr")) ((H coordp) (LOX "twoAddr")) ((G coordp) (LOX "twoAddr")) ((F coordp) (LOX "twoAddr")) ((E coordp) (LOX "twoAddr")) ((D coordp) (LOX "twoAddr")) ((C coordp) (LOX "twoAddr")) ((B coordp) (LOX "twoAddr")) ((A coordp) (LOX "twoAddr")) ((@ coordp) (LOX "twoAddr")) ((? coordpp) (HIADDR LOX "threeAddr")) ((> coordpp) (HIADDR LOX "threeAddr")) ((= coordpp) (HIADDR LOX "threeAddr")) ((< coordpp) (HIADDR LOX "threeAddr")) ((|;| coordpp) (HIADDR LOX "threeAddr")) ((: coordpp) (HIADDR LOX "threeAddr")) ((|9| coordpp) (HIADDR LOX "threeAddr")) ((|8| coordpp) (HIADDR LOX "threeAddr")) ((|7| coordpp) (HIADDR LOX "threeAddr")) ((|6| coordpp) (HIADDR LOX "threeAddr")) ((|5| coordpp) (HIADDR LOX "threeAddr")) ((|4| coordpp) (HIADDR LOX "threeAddr")) ((|3| coordpp) (HIADDR LOX "threeAddr")) ((|2| coordpp) (HIADDR LOX "threeAddr")) ((|1| coordpp) (HIADDR LOX "threeAddr")) ((|0| coordpp) (HIADDR LOX "threeAddr")) ((/ coordpp) (HIADDR LOX "threeAddr")) ((. coordpp) (HIADDR LOX "threeAddr")) ((- coordpp) (HIADDR LOX "threeAddr")) ((, coordpp) (HIADDR LOX "threeAddr")) ((+ coordpp) (HIADDR LOX "threeAddr")) ((* coordpp) (HIADDR LOX "threeAddr")) ((|)| coordpp) (HIADDR LOX "threeAddr")) ((|(| coordpp) (HIADDR LOX "threeAddr")) ((|'| coordpp) (HIADDR LOX "threeAddr")) ((& coordpp) (HIADDR LOX "threeAddr")) ((% coordpp) (HIADDR LOX "threeAddr")) (($ coordpp) (HIADDR LOX "threeAddr")) ((|#| coordpp) (HIADDR LOX "threeAddr")) ((|"| coordpp) (HIADDR LOX "threeAddr")) ((! coordpp) (HIADDR LOX "threeAddr")) ((| | coordpp) (HIADDR LOX "threeAddr")) ((_ coordpp) (LOX "loLoAddr")) ((^ coordpp) (LOX "loLoAddr")) ((|]| coordpp) (LOX "loLoAddr")) ((|\\| coordpp) (LOX "loLoAddr")) ((|[| coordpp) (LOX "loLoAddr")) ((Z coordpp) (LOX "loLoAddr")) ((Y coordpp) (LOX "loLoAddr")) ((X coordpp) (LOX "loLoAddr")) ((W coordpp) (LOX "loLoAddr")) ((V coordpp) (LOX "loLoAddr")) ((U coordpp) (LOX "loLoAddr")) ((T coordpp) (LOX "loLoAddr")) ((S coordpp) (LOX "loLoAddr")) ((R coordpp) (LOX "loLoAddr")) ((Q coordpp) (LOX "loLoAddr")) ((P coordpp) (LOX "loLoAddr")) ((O coordpp) (LOX "loLoAddr")) ((N coordpp) (LOX "loLoAddr")) ((M coordpp) (LOX "loLoAddr")) ((L coordpp) (LOX "loLoAddr")) ((K coordpp) (LOX "loLoAddr")) ((J coordpp) (LOX "loLoAddr")) ((I coordpp) (LOX "loLoAddr")) ((H coordpp) (LOX "loLoAddr")) ((G coordpp) (LOX "loLoAddr")) ((F coordpp) (LOX "loLoAddr")) ((E coordpp) (LOX "loLoAddr")) ((D coordpp) (LOX "loLoAddr")) ((C coordpp) (LOX "loLoAddr")) ((B coordpp) (LOX "loLoAddr")) ((A coordpp) (LOX "loLoAddr")) ((@ coordpp) (LOX "loLoAddr")) )