home *** CD-ROM | disk | FTP | other *** search
/ cs.rhul.ac.uk / www.cs.rhul.ac.uk.zip / www.cs.rhul.ac.uk / pub / rdp / 00readme.1_6 next >
Text File  |  2004-10-19  |  19KB  |  415 lines

  1. The sixth maintenance release of RDP (version 1.6) is now available via ftp 
  2. from ftp.cs.rhbnc.ac.uk in directory /pub/rdp. Get rdp1_6zip if you are an
  3. MS-DOS user or rdp1_6.tar if you are a Unix user. You can also access the
  4. ftp server via the rdp web site at      
  5.  
  6.       http:\\www.cs.rhul.ac.uk\research\languages\rdp.shmtl
  7.  
  8.  
  9. Version 1.6 mostly fixes bugs in version 1.5.
  10.  
  11.  
  12. The fifth maintenance release of RDP (version 1.5) is now available via ftp 
  13. from ftp.cs.rhbnc.ac.uk in directory /pub/rdp. Get rdp1_5.zip if you are an
  14. MS-DOS user or rdp1_5.tar if you are a Unix user. You can also access the
  15. ftp server via the rdp web site at      
  16.  
  17.       http:\\www.ds.rhul.ac.uk\research\languages\rdp.shmtl
  18.  
  19. This release includes the following new features
  20.  
  21.  - an new iterator operator,
  22.  
  23.  - new positive closure syntax,
  24.  
  25.  - a new command line argument processing library,
  26.  
  27.  - a new graph construction and manipulation library with support for the VCG 
  28.    (Visualisation of Compiler Graphs) tool so that you can look at your data 
  29.    structures under Unix/X-windows and Microsoft Windows,
  30.  
  31.  - improvements to the formatting of error messages,
  32.  
  33.  - scanner lookahead for the REAL primitive,
  34.  
  35.  - support for underscores in INTEGER and REAL literals,
  36.  
  37.  - a new naming convention that removes the conflict between some C++
  38.    implementations and the double underscore naming convention,
  39.  
  40.  - support for integer literal, real literal and string literal parameters to
  41.    parser functions,
  42.  
  43.  - improvements to the entry code for parser functions so that semantic
  44.    actions behave sensibly for productions with optional bodies,
  45.  
  46.  - extensive new facilities for constructing and manipulating derivation trees 
  47.  
  48.  - new debugging options that help trace a parser's behaviour,
  49.  
  50.  - updated user and support library manuals,
  51.  
  52.  - a new tutorial manual,
  53.  
  54.  - a new case study manual which describes two interpreters, two compilers and
  55.    a C pretty printer
  56.  
  57. A fuller list of changes will be found at the end of this message.
  58.  
  59. *** VERY IMPORTANT WARNING
  60.  
  61. One seriously non-backwards compatible change involving the <...> construct
  62. has been incorporated in version 1.5. Read the compatibility section below 
  63. before processing a pre-version 1.5 grammar that includes instances of the
  64. <...> with this version of RDP. All occurences of <...>'x' MUST be replaced
  65. with (...)@'x' because the semantics of the <...> construct have been changed.
  66.  
  67. *** END OF VERY IMPORTANT WARNING
  68.  
  69. **** Here follows a thumbnail sketch of RDP ****
  70.  
  71. RDP - a recursive descent parser generator with one symbol of lookahead
  72.  
  73. RDP compiles attributed LL(1) grammars decorated with C-language
  74. semantic actions into recursive descent parsers. 
  75.  
  76. RDP is written in strict ANSI-C and produces strict ANSI-C. RDP was
  77. developed using Borland C++ versions 3.1 and 5.1 on a PC and has also
  78. been built with no problems on Alpha/OSF-1, DECstation/Ultrix, HP
  79. Apollo/HPUX, Sun 4/SunOS, Solaris, Linux and NetBSD 0.9 hosts all using
  80. gcc and g++ as well as variety of vendor's own compilers. RDP also
  81. compiles for MS-DOS under Microsoft C V7.0, gcc (using the djpgg port)
  82. and several other compilers. I have reports of successful builds on Mac,
  83. Amiga and the Acorn Archimedes.
  84.  
  85. The definition of strict ANSI here means compiling under gcc with
  86.  
  87. gcc -Wmissing-prototypes -Wstrict-prototypes -fno-common -Wall -ansi -pedantic
  88.  
  89. and getting no warning messages.
  90.  
  91. RDP is C++ `clean' i.e. there are no identifiers used that clash with C++
  92. reserved words. RDP generated code has been used with g++ applications, and
  93. compiles with g++ and the Borland C++ (as opposed to ANSI C) compiler.
  94.  
  95. RDP itself, and the language processors it generates, use standard library
  96. modules to manage symbol tables, sets, graphs, memory allocation, text
  97. buffering, command line argument processing and scanning. The RDP scanner is
  98. programmed by loading tokens into a symbol table at the start of each run. In
  99. principle, the RDP scanner can be used to support runtime extensible
  100. languages, such as user defined operators in Algol-68, although nobody has had
  101. the nerve to try this yet.
  102.  
  103. RDP produces complete runnable programs with built-in help information and
  104. command line switches that are specified as part of the EBNF file. In this
  105. sense RDP output is far more shrink-wrapped than the usual parser generators
  106. which helps beginners. 
  107.  
  108. The RDP text buffering routines automatically handle nested files, error
  109. message reporting and text data buffering to provide an efficient general
  110. purpose front end. This is also a great help to new users since writing
  111. efficient (and correct) text buffering and scanning routines from scratch is,
  112. in my experience, harder than it appears.
  113.  
  114. The RDP graph handling package provides a general framework for building
  115. graph data structures that may then be output in a form suitable for display 
  116. with the VCG (Visualisation of Compiler Graphs) tool. RDP generated parsers
  117. can be set to automatically build derivation trees in a form suitable for
  118. human viewing. VCG runs on Windows 3.1, Windows-95 and Unix/X-windows systems.
  119. We are grateful to the author of VCG for permission to supply VCG with RDP: you
  120. can fetch a copy of VCG from the home FTP site for RDP 
  121. (ftp://ftp.cs.rhbnc.ac.uk/pub/rdp)
  122.  
  123. RDP generates itself (you mean you use a parser generator which _isn't_
  124. written in its own source language?) which is a nice demonstration of
  125. the bootstrapping technique used for porting compilers to new
  126. architectures.
  127.  
  128. I wrote RDP because in October '94 I started giving a course on compiler
  129. design. I am mainly interested in code generation for exotic processors,
  130. so I tried to produce a compact parser generator that would enable
  131. undergraduates to rip through the syntax and standard code generation
  132. parts of the syllabus in a few weeks, thus leaving me time to get into
  133. the black arts of code scheduling and optimisation.
  134.  
  135. What you get.
  136.  
  137. - The machine generated source for the RDP translator (rdp.c). RDP checks that
  138.   the source grammar is LL(1) and explains exactly why a non-LL(1) grammar is 
  139.   unacceptable. This version of RDP does not attempt to rework a grammar by
  140.   itself.
  141.  
  142. - The decorated EBNF file describing RDP that was processed by the RDP
  143.   executable to produce its own source code (rdp.bnf). This is good for
  144.   boggling undergraduate's minds with.
  145.  
  146. - Decorated EBNF files for the languages minicalc, minicond, miniloop
  147.   and minitree that are used as examples in the case study manual. The 
  148.   languages illustrate the development of a simple programming language 
  149.   by way of a syntax checker, two interpreters and finally two syntax-directed
  150.   compilers that produces assembly language for a mythical machine called
  151.   MVM (Mini Virtual Machine). One of the compilers is a single pass
  152.   translator and the other uses a tree-based intermediate form.
  153.  
  154. - The decorated EBNF file for mvmasm, an assembler for the language
  155.   produced by the above compilers along with a simulator called mvmsim for the
  156.   resulting executable files.
  157.  
  158. - An EBNF file describing a not particularly standard Pascal with some
  159.   extensions for Turbo Pascal which generates a fully working parser.
  160.  
  161. - An ANSI C pretty printer written using RDP
  162.  
  163. - A set of functions to automate the handling of command line arguments (arg.c).
  164.  
  165. - Routines to implement general graph data structures (graph.c).
  166.  
  167. - A set of wrapper functions for the standard C memory allocation routines
  168.   with built in fatal error handling for out of memory errors (memalloc.c).
  169.  
  170. - A programmable scanner with integrated error handling (scan.c and scanner.c).
  171.  
  172. - A set-handling package that supports dynamically sizable sets (set.c).
  173.  
  174. - A hash-coded symbol table with support for multiple symbol tables,
  175.   nested scope rules and arbitrary user data (symbol.c).
  176.  
  177. - A standard text buffering package with integrated messaging utilities that
  178.   are used for all communication with the user (textio.c).
  179.  
  180. - Sources and makefiles for everything which you may use freely on condition
  181.   that you send copies of any modifications, enhancements and ill-conceived
  182.   changes you might make back to me so that I can improve RDP.
  183.  
  184. - User, library support, tutorial and case study manuals.
  185.  
  186. What you don't get.
  187.  
  188. - Warranties. This code has only just escaped from my personal toolkit.
  189.   I've put a lot of effort into making it fit for others to use, but in
  190.   the very nature of compiler compilers it is hard to test all the angles,
  191.   and the Garbage In - Garbage Out principle holds to the highest degree:
  192.   if you write ill-formed semantic actions you won't find out until you try
  193.   and compile the compiler that RDP wrote for you. On the plus side, RDP has
  194.   now been used pretty ferociously by lots of people and has stood up very
  195.   well. It does seem to be pretty stable, and I will continue to respond to
  196.   bug reports.
  197.  
  198. ** RDP release version 1.50 flyer. Adrian Johnstone 16 August 1997 **
  199.  
  200. This is the RDP V1.50 release distribution. To install RDP look in the
  201. makefile and ensure that the blocks of options at the top are commented out
  202. correctly for your compiler and operating system. Then type 'make' (or 'nmake'
  203. if you are a Microsoft  compiler user) and stand well back.
  204.  
  205. If you use an ANSI compiler then you should be able to build RDP after you
  206. have uncommented suitable compiler switch options in the makefile. I'd really
  207. like to hear about any problems you have with other MS-DOS or Unix C
  208. compilers - my aim is to make RDP as portable as TeX (some hope).
  209.  
  210. Further documentation may be found in Postscript and DVI forms in subdirectory
  211. 'manuals'.
  212.  
  213. We'd like to thank the many people who have tried RDP and sent me encouraging
  214. messages, suggestions for improvements and bug reports, in particular Andy
  215. Betts (previously of UCL, now at Inmos), my students on course CS347
  216. (compilers and code generation) at RHUL.
  217.  
  218. ** Improvements in this version include **
  219.  
  220. NEW FEATURES
  221.  
  222. 1. A new iteration operator @ has been introduced which subsumes all of the
  223. EBNF brackets which are now represented internally as special cases of the @
  224. operator. The old <...>'x' construct should now be written as (...)@'x'.
  225.  
  226. 2. <...> is now used to represent positive closure (one or many).
  227.  
  228. 3. Scanner lines are now echoed after error messages have been written. This
  229. allows a more compact `pointing' notation, and the delayed echo makes it
  230. possible to insert text before the echoed line which is useful for assemblers,
  231. as demonstrated by the mvmasm assembler described in the tutorial manual.
  232.  
  233. 4. A new scanner primitive CHARACTER has been added that reads a single stropped,
  234. quoted character.
  235.  
  236. 5. LL(1) errors detected during grammar parsing are now flagged in the parser
  237. source code, so that if you are stepping through a parser using a debugger
  238. you will be reminded that something odd is about to happen. Look in pascal.c
  239. (which is created during a make all) for an example.
  240.  
  241. 6. A new option -P has been added to RDP. Parsers generated with this option
  242. issue information messages on entry and exit from each parser function: this
  243. can be useful for tracing parser operation but as you might expect it produces
  244. a lot of output.
  245.  
  246. 7. A new support library module (arg.c) has been added to handle processing of
  247. command line arguments in a standard way. New directives ARG_BOOLEAN,
  248. ARG_NUMERIC and ARG_STRING have been added to RDP and the OPTION directive has
  249. been dropped. The old OPTION directive has been dropped.
  250.  
  251. 8. A new support library module (graph.c) has been added which handles general
  252. graph datastructures. 
  253.  
  254. 9. The graph library can output any graph in a form suitable for viewing with
  255. the VCG (Visualisation of Compiler Graphs) tool written by
  256. You can fetch a copy of VCG for Unix/X-windows or MS-Windows systems from 
  257. ftp://ftp.dcs.rhbncs.ac.uk/pub/rdp. 
  258.  
  259. 10. Three new directives TREE, EPSILON_TREE and ANNOTATED_EPSILON_TREE have been 
  260. added that cause parsers to build derivation trees using the new graph library.
  261.  
  262. 11. Node promotion operators (^, ^^, ^^^ and ^_) have been added that
  263. allow the standard derivation trees to be modified during construction
  264. into intermediate tree forms suitable for use with multiple pass
  265. compilers. This notation is rather experimental and we would very much
  266. like to hear users' opinions on its ease or difficulty of use. (See
  267. Chapters 9 and 10 of the user manual and Chapter 8 of the case study
  268. manual for descriptions of the new tree features.)
  269.  
  270. 12. A new option -V<name> has been added to parsers generated with the 
  271. TREE directive. At completion of a parse that parser will dump a VCG
  272. compatible description of the derivation tree to <name>. You can then
  273. use the VCG tool under MS-Windows or Unix/X-windows to view the graph.
  274.  
  275. 13. Support for parameter passing into parser functions (inherited attributes)
  276. has been improved. Formal parameter types may now include indirect types such
  277. as char*. In addition, literal strings, real and integer numbers can be used
  278. as actual parameters.
  279.  
  280. 14. Underscores may now be inserted into numeric literals in the style
  281. of Ada, so for instance 278_101_123 is a valid INTEGER literal.
  282.  
  283. 15. A new tutorial guide for new users has been added, covering the
  284. basic steps required to build a parser for a new language.
  285.  
  286. 16. A new case study manual has been added that describes the
  287. development of a family of language translators, culminating in a
  288. compiler that produces code for a virtual machine. An assembler and
  289. simulator for the target machine are also provided.
  290.  
  291. FIXES and ENHANCEMENTS
  292.  
  293. 17. All RDP indentifiers of the form xxx__yyy are renamed to xxx_yyy to avoid
  294. clashes with some C++ implementations (sigh). RDP now checks explicitly for
  295. identifiers that begin arg_, graph_, mem_, rdp_, scan_ set_, sym_ or text_ and
  296. issues an error message if it finds any so as to avoid clashes with built in
  297. identifer names. Sorry about this change, but I didn't know that the orginal
  298. AT&T C++ front end uses double underscore internally rather a lot. Teach me to
  299. read the book more carefully.
  300.  
  301. 18. The set_print routine now takes a line length argument so that line breaks
  302. can be inserted in long lists. This feature is used to suppress the very long
  303. lines in set initialisation code that have been causing some editors to break.
  304.  
  305. 19. Parsers now exit at the end of a pass in which errors occur.
  306.  
  307. 20. The scanner now looks ahead when checking for a real to make sure things of
  308. the form 1..3 are reported as 1 followed by .. followed by 3 rather than 1.0
  309. followed by 0.3.
  310.  
  311. 21. The nasm assembler has been replaced by mvmasm, an assembler along
  312. with a simulator called mvmsim that takes the output from the miniloop
  313. and minitree compilers.
  314.  
  315. 22. An unterminated comment (i.e. an EOF appearing within a comment) is
  316. now detected and reported as: `fatal: EOF detected inside comment'.
  317.  
  318. 23. If the -T command line option is used to set the text buffer size to a
  319. value that is larger than the maximum value of size_t on the architecture, a
  320. warning message is issued and the type recast to size_t (which usually
  321. results in a wrap-around).
  322.  
  323. 24. symbol_lookup() now takes a scope argument.
  324.  
  325. 25. A new routine, symbol_find() allows common symbol update operations
  326. to be implemented in a single call.
  327.  
  328. 26. rdp productions returning void* (or for that matter void**...) results
  329. are now correctly implemented. Previously, the word void in a return type
  330. was enough to suppress generation of a result variable.
  331.  
  332. 27. Continuation tokens are now correctly added for tokens that appear
  333. in extended scanner primitives like STRING and COMMENT.
  334.  
  335. 28. Extended tokens (string and comment scanner primitives) now map to their
  336. opening tokens rather than the equivalent scanner primitive. This corrects a
  337. truly awful design error that I discovered the hard way when I wanted two
  338. alternates to start with different kinds of escaped strings. The fixes to the
  339. scanner are rather ugly.
  340.  
  341. 29. When using included files (i.e. nested called to text_open() ) a token
  342. was being lost in the parent file after the included file closed. This has been
  343. corrected.
  344.  
  345. 30. A production containing only references to the three non-visible COMMENT
  346. scanner primitives will not generate a `production never called' warning.
  347.  
  348. 31. Grammars containing only scanner primitives and nonterminals (i.e. grammars with
  349. no keywords) are now handled correctly.
  350.  
  351. 32. New functions have been added to the text library to get the current tabwidth
  352. setting and print strings as ANSI C character constants.
  353.  
  354. 33. Multiline comments are now returned correctly in the COMMENT...VISIBLE
  355. scanner primitives.
  356.  
  357. 34. The lexeme for INTEGER and REAL scanner primitives is now returned in the
  358. id field.
  359.  
  360. 35. The rdp_sourcefilename global variable is now updated to show the actual file
  361. used (after file type processing) rather than the name used on the command line.
  362.  
  363. NON-BACKWARDS COMPATIBLE CHANGES -- IMPORTANT!
  364.  
  365. 36. The <body> 'token' construct is now represented by (body)@'token'.
  366.  
  367. <body> on its own now represents the positive closure of body, that is
  368. body{body}. Very sorry about this. Be careful!
  369.  
  370. **** Features for future versions
  371.  
  372. This will be the last functionality release for RDP version 1, although
  373. I will put out bug fixes as necessary. For most of this year I have been
  374. building small prototypes of a system for performing rather more general
  375. recursive descent parsers. Sometime soon a new translator generator tool
  376. called PGT (the Permutation Grammar Tool) will appear.
  377.  
  378. PGT will support LL(oo) parsing, that is arbitrary backtracking will be
  379. applied where necessary.  In principle this will allow many more context
  380. free grammar to be parsed, but not necesarilly in linear time. You will
  381. be warned of any non-linearities.
  382.  
  383. PGT will support scanner productions which supersede the various
  384. programmable tokens used at the moment. A customised scanner for each
  385. language will then be written out for each language.
  386.  
  387. As part of the scanner production support, subproductions comprising a list
  388. of alternates each of which is exactly one terminal long will automatically
  389. be translated into a set of such tokens. NOT and wildcard operators will be
  390. provided.
  391.  
  392. The iteration operator @ will be enhanced to handle general iteration
  393. and permutation phrases.
  394.  
  395. Other suggestions for improvements are welcome.
  396.  
  397. ***
  398. Comments, queries and requests for code to Adrian Johnstone, address below.
  399.  
  400. ***
  401. Primary code author and joint author of manuals
  402.  
  403. Smail: Dr Adrian Johnstone, Computer Science Department, Royal Holloway, 
  404.        University of London, Egham, Surrey, TW20 0EX, UK.
  405.  
  406. Email: A.Johnstone@rhbnc.ac.uk  Tel: +44 (0)1784 443425  Fax: +44 (0)1784 443420
  407.  
  408. Joint authorship of manuals and chief code checker
  409.  
  410. Smail: Dr E Scott, Computer Science Department, Royal Holloway, 
  411.        University of London, Egham, Surrey, TW20 0EX, UK.
  412.  
  413. Web:   http:\\www.dcs.rhbnc.ac.uk\research\languages\index.html
  414. ***
  415.