| 1 |
TCLL1 |
| 2 |
The TCLL1 Parser Generator and Parser |
| 3 |
(TC: "Tools of Computing") |
| 4 |
|
| 5 |
BUILD1.BAT MS-DOS batch file to compile TCLL1. It should be |
| 6 |
able to execute as a shell script under UNIX. |
| 7 |
|
| 8 |
TCLL1.ICN main program for TCLL1 |
| 9 |
LL1.ICN LL(1) parser generation routines |
| 10 |
SCANGRAM.ICN scanner for input grammars |
| 11 |
SEMGRAM.ICN semantics routines for handling the input grammars |
| 12 |
TCLL1.GRM grammar for input grammars |
| 13 |
TCLL1.LL1 translated input grammar for input grammars |
| 14 |
GRAMANAL.ICN context-free grammar analysis module |
| 15 |
|
| 16 |
PARSELL1.ICN LL(1) parser |
| 17 |
READLL1.ICN input routine for translated grammars |
| 18 |
SEMSTK.ICN semantics routines called by PARSELL1.ICN to handle |
| 19 |
the semantics stack |
| 20 |
|
| 21 |
RPTPERR.ICN routine to report syntax errors |
| 22 |
|
| 23 |
SEMOUT.ICN semantics routines just to write out the tokens and |
| 24 |
action symbols (for early stages of debugging the |
| 25 |
grammar) |
| 26 |
|
| 27 |
|
| 28 |
Building the parser generator |
| 29 |
|
| 30 |
Before reading the rest of this description of TCLL1, you |
| 31 |
should compile it on your own system. That will allow you to |
| 32 |
try out the test grammars as they are discussed. |
| 33 |
|
| 34 |
If you do not have a copy of Icon, you can get it over the |
| 35 |
Internet: ftp it from cs.arizona.edu: |
| 36 |
ftp ftp.cs.arizona.edu |
| 37 |
name: anonymous |
| 38 |
password: your_e-mail_address |
| 39 |
cd icon |
| 40 |
|
| 41 |
Versions of Icon for several machines are in subdirectories of |
| 42 |
directory icon. You may also want to pick up the Icon |
| 43 |
Programming Library. |
| 44 |
|
| 45 |
If you have the Icon Programming Library (IPL) installed on a |
| 46 |
DOS/WINDOWS machine, you can execute the batch file |
| 47 |
mktcll1.bat to build the parser generator. The three files from |
| 48 |
the IPL that the parser generator uses are included with this |
| 49 |
distribution and can be compiled separately. To build the |
| 50 |
parser generator by hand, you may execute |
| 51 |
|
| 52 |
rem These are from the Icon Program Library: |
| 53 |
|
| 54 |
icont -c escape ebcdic xcode |
| 55 |
|
| 56 |
rem These form the parser generator proper |
| 57 |
|
| 58 |
icont -c gramanal ll1 semstk readll1 parsell1 scangram semgram |
| 59 |
icont -fs tcll1 |
| 60 |
|
| 61 |
The first icont line compiles the files from the IPL. You may |
| 62 |
omit the line if you have the IPL installed. The second icont |
| 63 |
line compiles modules used by the parser generator. The third |
| 64 |
line compiles the parser generator's main program. The flag -fs |
| 65 |
tells the translator that the parser generator calls some |
| 66 |
procedures by giving their names as strings. In Icon version 8, |
| 67 |
this flag is not needed; in version 9 it is. |
| 68 |
|
| 69 |
To use TCLL1 to build a parsing table, execute |
| 70 |
|
| 71 |
Under Icon version 8: |
| 72 |
|
| 73 |
iconx tcll1 grammar.grm |
| 74 |
|
| 75 |
Under Icon version 9: |
| 76 |
|
| 77 |
tcll1 grammar.grm |
| 78 |
|
| 79 |
where grammar.grm is the grammar file. The output of the parser |
| 80 |
generator will be encoded parse tables in file grammar.ll1 . If |
| 81 |
you would also like a listing of the grammar and diagnostic |
| 82 |
information, execute |
| 83 |
|
| 84 |
Under Icon version 8: |
| 85 |
|
| 86 |
iconx tcll1 -p grammar.grm |
| 87 |
|
| 88 |
Under Icon version 9: |
| 89 |
|
| 90 |
tcll1 -p grammar.grm |
| 91 |
|
| 92 |
Tlcll1 reads its own parsing table from file tcll1.ll1 which |
| 93 |
must be in the current directory. |
| 94 |
|