Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Tom Shields Newsgroups: comp.compilers Subject: Announcing Ox release 1.9 Date: Sat, 25 Jul 2020 11:43:13 -0500 Organization: Compilers Central Lines: 137 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <20-07-005@comp.compilers> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="714"; mail-complaints-to="abuse@iecc.com" Keywords: yacc, tools, available, attribute Posted-Date: 25 Jul 2020 14:24:54 EDT 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:2551 Ox version 1.9 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 postdecoration 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.9 (24 July 2020) ** Enhancements Ox new generates C++ lexer & parser specifications that work with the Flex, Bison, BtYacc and Msta C++ skeletons; C++ class, struct or union types with constructors and destructors are acceptable as Ox attribute type specifiers. A C++ replacement std::new()/std::delete() library is provided, compiled with the Boehm-Demers-Weiser Conservative C/C++ Garbage Collector (BDWGC) or the Dmalloc Debug Malloc Library (DMALLOC) package, if installed. Ox-generated AG evaluators in the distribution are linked with the corresponding library, if configured to build with one of these packages. The library can be installed for use by user AG evaluators. New command line options are provided to inform Ox of the intended AG evaluator target for code generation (lexer generator, parser generator, language). Use of these options is only necessary if Ox cannot infer the intended target from the Y-file or L-file. For example, the Bison directive '%skeleton "lalr1.cc"' found in the Y-file enables Ox to infer that the target parser generator is Bison and the target language is C++. ** Internals The C++ `new' & `delete' operators are used instead of `malloc()' & `free()' when compiling the Ox skeleton with a C++ compiler. The collection of attributes declared for a particular AG evaluator is generated as a union (`union yyyAttrbs') of the set of structure types (`struct yyyTn', for `n' from 1) generated from the attribute declarations present in the Y-file. This works for C, but a C++ class type (`struct', `class' or `union') with virtual member functions, or nontrivial constructors or destructors, cannot directly be a member of a union type. Ox generated code accomodates attributes with nontrivial C++ class types through the following approach: - generate a variant tag at the start of each `struct yyyTn' type definition - generate a constructor (`yyyTn(int yyyTypeNum)') to set the variant tag - the compiler generates code to invoke attribute default constructors and destructors - implement each member of `union yyyAttrbs' as an array of bytes sized to hold the corresponding `struct yyyTn' value - generate a default constructor (`yyyAttrbs()') to zero the allocated bytes - generate a constructor (`yyyAttrbs(int yyyTypeNum)') using a placement new operator applied to "static_cast((void *)this)" to invoke the `yyyTn(yyyTypeNum)' constructor (via a `switch' statement) - generate a destructor (`~yyyAttrbs()') to explicitly call the corresponding compiler-generated `~yyyTn()' destructor (via a `switch' statement) - if an attribute class type requires a parameterized constructor, it must be called within the evaluation part of each definition of that attribute using a placement new operator The Ox parser will only build from scratch with `bison' 3.7+. ** Bug fixes Corrected bugs introduced in release 1.8: - broken code was generated for the "-u" command line option - generated Bison or BYacc parsers failed to compile if the Y-file contained a `%destructor' or `%printer' directive defined for "<*>" - `genYaccUnionDecl()' ignored the `targetT' parameter - `finishYfileDefinitionSection()' dropped code needed in the Ox-generated header if the "%define api.value.type union" directive was used ** Documentation The User Reference Manual was revised to define the directives Ox currently uses to infer aspects of the intended AG evaluator generation target in Appendix E (Lex- and Yacc-compatible tool interoperation). ** Test suite New Bison, BtYacc & Msta test cases were added for C++. Flex C++ capabilities are used in these test cases, if that support is installed. The existing BtYacc test cases now use the new Ox C++ capabilities. The oldest versions of the BtYacc parser skeleton requires C++, and there is no mechanism in BtYacc to get the version, so all BtYacc test cases always use a C++ compiler. ** Build system A new configuration option is introduced to enable installation of the C++ replacement std::new()/std::delete() library for use by AG evaluators. Ox successfully builds and passes the test suite with the MinGW-w64 build environment (both 64- and 32-bit) distributed as optional packages by Cygwin and Msys2. Multiple `./configure' processes can now run concurrently, which is useful for regression testing. The Ox configuration now disables multithreading by default. Formerly, The GNUlib default configuration enabled multithreading, if available.