Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Tom Shields Newsgroups: comp.compilers Subject: Announcing Ox release 1.10.1 Date: Wed, 2 Feb 2022 13:27:18 -0600 Organization: Compilers Central Lines: 125 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-02-001@comp.compilers> Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) Content-Type: text/plain; charset="us-ascii" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="95690"; mail-complaints-to="abuse@iecc.com" Keywords: parse, tools, attribute Posted-Date: 02 Feb 2022 14:43:02 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:2880 Ox version 1.10.1 is now available on SourceForge (sourceforge.net/projects/ox-attribute-grammar-compiler/). Ox generalizes the function of Yacc in the way that an attribute grammar generalizes a context-free grammar. Ordinary Yacc and Lex specifications may be augmented with definitions of synthesized and inherited attributes written in C/C++ syntax. Ox checks these specifications for consistency and completeness, and generates from them a program that builds and decorates attributed parse trees. The user may specify post-decoration traversals for easy ordering of side effects, such as code generation. Ox handles the tedious and error-prone details of writing code for parse-tree management, so its use eases problems of security and maintainability associated with that aspect of translator development. Ox NEWS * Noteworthy changes in release 1.10.1 (1 Feb 2022) ** Internals This release continues the upgrade of the Ox source from C99 to C++11. The Ox internal 'stringTable []' implementation was changed to use the 'std::unordered_map' container. The generation of 'yyyStringTab [] from the contents of 'stringTable []' was changed to eliminate empty entries. The code generation architecture was restructured: - The C 'typedef union target * targetT' pun (aka hack) was replaced with a class hierarchy, with abstract base class 'outMgr'. - The use of C global 'FILE *' variables and C standard library file management functions was replaced by a 'std::iostream *' member in class 'outMgr' and the respective member functions for output. - Classes derived from 'outMgr' unify output to files (using a 'std::fstream *' member) and in-memory buffers (using a 'std::stringstream *' member). - The generation of '#line' directives was simplified, replacing the 'targetT' pun's set of 'lex* ()' and ‘gen* ()' text output functions with a set of overloaded 'put ()' text output functions. - Calls to 'put ()' are preceded by a call to 'lex ()' (for input file '#line' directives) or 'gen ()' (for output file '#line' directives), as required. - The deferred blank line ring buffer complexity was simplified to just count blank lines submitted for output, but not yet written. - Blank lines (up to a maximum) are actually written to the output when switching between writing non-blank *as-is* input text and generated text, with '#line' directives written, as required. - Other code generation function name prefixes 'gen' and 'print' were replaced with 'put' for unifority. The lexer specifications are now processed by 'flex++': - The use of C global 'FILE *' variables and C standard library file management functions was replaced with 'std::ifstream' objects and the respecitive member functions for input. - The custom 'YY_INPUT ()' macro used with 'flex'-generated lexer source was replaced with an overriden 'LexerInput ()' implementation to handle the Windows "\r\n" EOL sequence. - The custom input buffer stack management was replaced with the 'flex' standard input buffer stack management. The following additional changes were made to the lexer specifications: - A number of individual pattern rules with the same action were combined into a single pattern rule using the '|' pattern alternative operator, for clarity. - The use of 'unput ()' was replaced with 'yyless ()', for efficiency. - A number of trailing context pattern rules were rewritten to eliminate the trailing context, for efficiency. ** Bug fixes Occurrences of unmatched ` and ' characters in // comments, which cause 'flex++' version 2.6.2 to run off the end of the specification file, were either removed or paired to avoid the issue. The error message string created for failure to erase a file was left in a global 'std::stringstream' buffer if the erase operation succeeded. Subsequent use of that global buffer for an error message contained the erase failure message text. The Y-file lexer was corrected to return the 'RBRACE' token for a '}' character in the Yacc definition section (not associated with a "% { ... }" C code block, which would normally never occur); it was incorrectly returning the 'LBRACE' token. The tree visualization skeleton was missing "#include " (for a C++ compile) or "#include " (for a C compile). If Ox is configured for a single target parser (e.g., with the option "--enable-target=bison"), only that corresponding target parser header file (e.g., '#include "agc-bison.hh"') is now processed when compiling './source/main.cc'. A typographical error in an attribute evaluation expression (a + operator in the expression should have been a - operator) was corrected in the '*calc*' test cases. The test suite cleanup configuration where the 'bison' version is < 3.5.4 was corrected. The './configure' script check for the presence of the C++ header 'FlexLexer.h' in the MinGW environment was corrected to look in the '/usr/include' system directory. If 'flex++' is used in the MinGW environment, the 'AM_CPPFLAGS' Automake variable is augmented with "-idirafter /usr/include" so the MinGW C++ compilers can find 'FlexLexer.h' at compile time. The './configure' script was corrected to extract the 'flex' version number regardless of the executable's name. ** Build system The C++ header 'FlexLexer.h' from the 'flex' distribution used to generated the distributed lexer C++ source was added to the './source' distribution directory. The 'FlexLexer.h' file installed in other environments may not match the distributed source, causing C++ compile failure. The './configure' script check for C++ compiler support for the "-std=gnu++11|14|17" option was changed to "-std=c++11|14|17". The Automake 'BUILT_SOURCES' variable is now only set if Ox is configured with the "--enable-maintainer-mode" option. The lexer generation Make rule is now only enabled if Ox is configured with the "--enable-maintainer-mode" option.