Announcing Ox release 1.12

Tom Shields <>
Wed, 13 Mar 2024 15:14:45 -0500

          From comp.compilers

Related articles
Announcing Ox release 1.12 (Tom Shields) (2024-03-13)
| List of all articles for this month |

From: Tom Shields <>
Newsgroups: comp.compilers
Date: Wed, 13 Mar 2024 15:14:45 -0500
Organization: Compilers Central
References: <>
Injection-Info:; posting-host=""; logging-data="29517"; mail-complaints-to=""
Keywords: available, tools, attribute
Posted-Date: 16 Mar 2024 21:34:37 EDT
In-Reply-To: <>

Ox version 1.12 is now available on SourceForge (

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.


* Noteworthy changes in release 1.12 (11 March 2024)

** Enhancements

This release completes the shift of the implementation from direct generation of mostly C (and a bit of C++) source code to generation of macro invocations. This change will simplify development and maintenance of the run-time attribute evaluator code. It should also simplify adding support for new languages, and new lexer and parser generators.

This initial implementation mostly moves the existing skeleton attribute evaluator code out of string arrays embedded in the Ox source code and into macros held in separate data files. In past releases, Ox generated code fragments specific to a particular attribute grammar specification directly for integration with the parser and lexer skeletons; now that is all handled by macros. M4 run on each file generated by Ox produces the final output.

Open source C++ solutions used for executing M4 as a sub-process are included in the distribution:
- pstreams ( POSIX only
- libexecstream ( POSIX and Windows implementations; the POSIX version is substantially slower than ‘pstreams' and so is only used in Windows environments

    - Ox has only been tested with ‘libexecstream' in Cygwin and Msys2 MinGW (Windows 10 x86_64) and Msys2 MinGW (Windows 11 ARM64) environments.
    - There is a random bug in the ‘libexecstream' Windows implementation in the environments tested: the sub-process management throws a timeout exception, but M4 has completed. Ox currently catches the timeout exception and issues a non-fatal diagnostic.

** Internals

The "unexpected '%union tag'" diagnostic in the Y-file lexer was removed. This error only occurred when the Ox parser specification used the Bison-specific Yacc extension, but the target parser generator was not Bison. Ox leaves it up to the target parser generator to diagnose the syntax error, if needed.

The "Yacc pseudo variable with no '%union'" diagnostic in the Y-file lexer was removed. This isn't necessarily an error, so Ox leaves it up to the target parser generator to decide.

Preprocessor directive token recognition in the L-file lexer and the associated parser rules were removed. This was found to not be necessary to handle the situation for which it was added in Ox version 1.11.

The 'yyyLRCIL[]' static data vector in the attribute evaluator skeleton was eliminated, as were the parameters passed to invocations of 'yyyGenLeaf ()', which were used to access that vector at run-time. The 'yyyLRCIL[]' entries were used to explicitly set specific leaf node reference count entries to zero. This was a holdover from the original Ox version 1.4 implementation, which reused a static memory buffer to create the contents of each leaf node. The current implementation creates a leaf node reference count vector directly on the heap, initializing the entries to zero at allocation.

** Bug fixes

Corrected a bug where an automatically generated copy rule attribute definition had an undefined source location.

Corrected a bug that computed incorrect dependees for an automatically generated synthesized copy rule attribute definition.

Restored the code that diagnosed multiply defined attributes that was removed in Ox release 1.6.1. The replacement for the removed code missed a case, and restoring the original solution was the better fix.

The token column location (‘yylloc.end.column') was incorrectly adjusted following an invocation of 'yyless (0)'; the column value adjustment was already handled by the implementation of 'yyless ()'.

The diagnostic location of an erroneous macro invocation was corrected.

The code generated for an NIO pseudo-attribute reference in a traversal action was corrected. In a Y-file rule, the reference was generated as if it was always a reference to '@<LHS>.NIO@'.

The Msta EBNF Yacc rule syntax extensions ‘list' and 'optional component' were corrected.

** Build System

Terminate './configure' with an error message if the build environment is not supported.

The Ox macro library is now installed by the 'make install' script.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.