home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- * LL(1) Language Analyzer *
- *****************************************************************
-
- BY:
- ROBERT M. WHITE
- H & W COMPUTER SYSTEMS, INC.
- P.O. BOX 4173
- BOISE, ID 83704
-
- DESCRIPTION:
- Thi≤á systeφá read≤á ßá BN╞á descriptioεá oµá aεáá LL(1⌐
- language¼á analyze≤á i⌠á fo≥ error≤ anΣ generate≤ thσá selectioε
- set≤ fo≥ thσ productions«á Variou≤ intermediatσ table≤ arσ als∩
- generated to allow better debugging of the language.
-
- SOURCE LANGUAGE:
- PL/I-8░ distributed by DIGITA╠ RESEARCH¼á PACIFI├ GROVE¼
- CALIFORNIA. Release developed under was 1.3.
-
- SYSTEM REQUIRED:
- 1. 8080/Z80 processor w/60k minimum.
- 3. 2 disk drives (I used Double-Density w/600k capacity.)
- 2. CP/═áá Releaseá 1.┤á or aboveá distributedá byá DIGITA╠
- RESEARCH, PACIFIC GROVE, CALIFORNIA.
- 3. PL/I-8░ distributed by DIGITA╠ RESEARCH¼á PACIFI├ GROVE¼
- CALIFORNIA. Release developed under was 1.3.
-
- INSTALLATION:
- 1⌐á Adjus⌠ LL1ANL.SU┬ t∩ reflec⌠ thσ prope≥ drivσá whicΦ
- contains the source.
- 2) Submit the file, LL1ANL.SUB.
-
- SYSTEM EXECUTION:
- 1⌐á Pu⌠ thσ BN╞ gramma≥ int∩ ß filσ witΦ thσá extensioε
- oµ GM╥ (i.e«á EXAMPLE.GMR)«á Thi≤ filσ i≤ expecteΣ
- t∩ bσ iε standarΣ sourcσ forma⌠ (i.e«á eacΦ linσ i≤
- terminateΣ witΦ ß carriage-return¼ line-feed)« Thσ
- format of the BNF must be as follows:
- <grammar> -> <rule> '<eof>'
- ;
- <rule> -> '<ident>' <alt> ';' <rule>
- ->
- ;
- <alt> -> '->' <rp> <alt>
- ->
- ;
- <rp> -> '<string>' <rp>
- -> '<ident>' <rp>
- ->
- ;
- Aεá identifie≥ i≤ an∙ 1-╕ character≤ surroundeΣá b∙
- <...╛á (i.e«áá <grammar>«á ┴á strinτá i≤á an∙á 1-╕ è character≤áá surrounΣá b∙áá quote≤áá (i.e«áá '->')«
- Comment≤á ma∙á bσ addeΣ t∩ thσ enΣ oµ an∙á linσá b∙
- merel∙á codinτ ß '$ º anΣ theε thσá comments«á Thσ
- analyze≥á als∩á ha≤ certaiε switche≤ whicΦá ma∙á bσ
- turneΣá oε o≥ ofµ b∙ usinτ thσ '$º followeΣ b∙á thσ
- switcΦá numbers«áá Revie≈á program¼áá LL1P10¼á fo≥
- further information.
- 2⌐á Sincσá thσ program≤ use≤ overlays¼á thσá currentl∙
- loggeΣá disδ mus⌠ bσ thσ onσ containinτ thσá objec⌠
- fo≥ LL1ANL.COM«á T∩ analyzσ ß grammar¼á ente≥á thσ
- following:
- LL1ANL grammar_file_name<return>
- For example, the example grammar was analyzed with:
- LL1ANL EXAMPLE<return>
- The file extension of GMR is always assumed.
- áááááááá3) Prin⌠á thσá filσá witΦ thσ extensioε oµá PR╬á (i.e«
- áááááááááááááEXAMPLE.PRN)« Thi≤ wil∞ prin⌠ thσ selectioε se⌠ a≤
- áááááááááááááwel∞á a≤ thσ intermediatσ table≤ useΣ t∩á calculatσ
- áááááááááááááthσ selectioε set« Thσ las⌠ repor⌠ wil∞ onl∙ exis⌠
- áááááááááááááiµá thσ gramma≥ i≤ no⌠ LL(1⌐ anΣ i⌠á wil∞á indicatσ
- áááááááááááááwhicΦ production≤ causeΣ i⌠ no⌠ t∩ be.
-
- FILES DONATED:
- EXAMPLE.GMR - First example grammar
- EXAMPLE2.GMR - Second example grammar
- LL1ANL.DOC - The file that you are reading.
- LL1ANL.PLI - Driver program
- LL1ANL.SUB - Command List to Compile and Link
- the language analysis programs.
- LL1CMN.DCL - Common area for all programs
- LL1LNK.SUB - Command List to Link the language analysis
- programs after re-compiling one of them.
- LL1PRC.DCL - Common Procedures Declarations
- LL1PRC.PLI - Common Procedures generated in LL1ANL
- LL1P10.PLI - Language Parser
- LL1P20.PLI - Language Sort and Print
- LL1P30.PL╔ - Languagσ Analysi≤ - FinΣ Nullablσ
- Production≤ anΣ Non-terminals
- LL1P40.PL╔ - Languagσ Analysi≤ - Calculate the
- Beginning type relationships
- LL1P50.PL╔ - Languagσ Analysi≤ - Calculate the
- Ending type relationships
- LL1P60.PL╔ - Languagσ Analysi≤ - Calculate the
- Follow Set Relationship
- LL1P70.PL╔ - Languagσ Analysi≤ - Calculate the
- Selection Set for all productions
- LL1P80.PL╔ - Languagσ Analysi≤ - Validate that
- the language is LL(1)
-
- REFERENCES:
- These programs were written from the outline given in:
- 'COMPILER DESIGN THEORY' by P.M. Lewis III,
- D.J. Rosenkrantz and R.E. Stearns, Addison-
- Wesley Publishing Company, 1978.
- If you are going to use this system, it is highly re-
- commended that you get this book.
- Other books referenced:
- 1. 'Compiler Design and Construction' by
- Arthur Pyster, Van Nostrand Reinhold Co.,
- 1980.
- 2. 'Structured System Programming' by Jim
- Welsh & Michael McKeag, Prentice-Hall
- International, Inc., 1980.
- 3. 'Algorithms + Data = Programs', by N.
- Wirth, Prentice-Hall International, Inc.,
- 1976.
-
- FUTURE ENHANCEMENTS:
- The following is list of items that I may or may not get
- around to doing. They represent enhancements or changes
- for the better (I hope!).
- 1. Add the following to the input language:
- a. Allow sections of terminals to be sur-
- rounded by parentheses followed by a
- '?' for 0 or 1 repetitions, '*' for 0 or
- more repetitions or '+' for 1 or more
- repetitions.
- b. Allow lists to be defined as <nt> LIST
- ',' which denotes a list of <nt>'s seperated
- by commas.
- 2. Add a phase which checks for left recursion
- since this is the most deadly sin.
- 3. Add a phase which given the internal language
- tables and the selection set produces the outline
- of the compiler for all the various rules.
-
- NOTICE OF PUBLIC DOMAIN:
- The files herein contained and denoted under my controlè arσá hereb∙á placeΣ int∩ thσ publiπ domaiεá anΣá ma∙á bσ
- freely distributed for any non-commercial personal use.
-
-
-
- Robert M. White
- July 15, 1981
-