Announcing Ox release 1.8

Tom Shields <thomas.evans.shields@gmail.com>
Sat, 16 May 2020 13:51:21 -0500

          From comp.compilers

Related articles
Announcing Ox release 1.8 thomas.evans.shields@gmail.com (Tom Shields) (2020-05-16)
| List of all articles for this month |
From: Tom Shields <thomas.evans.shields@gmail.com>
Newsgroups: comp.compilers
Date: Sat, 16 May 2020 13:51:21 -0500
Organization: Compilers Central
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="30949"; mail-complaints-to="abuse@iecc.com"
Keywords: parse, tools, available
Posted-Date: 16 May 2020 15:39:56 EDT

Ox version 1.8 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 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.8 (16 May 2020)


** Enhancements


The relevant C/C++ type specification syntax is supported.


The `%param' and `%parse-param' directives (`bison', `byacc') are recognized,
and the added `yyparse()' parameters are made accesible within attribute
evaluation code.


The `%define api.value.type union' directive (`bison') is accepted as a valid
mechanism for defining the semantic value type, along with the associated
`bison' extension that interprets the tags of Yacc grammar symbol type
declarations as types, rather than as member names of the semantic value
type.


The '%token TOKEN "literal string token"' directive (`bison') is recognized,
and the `"literal string token"' is treated as an alias for `TOKEN'.


The `%define api.token.prefix {PREFIX}' directive (`bison') is recognized,
and
a prefixed symbol is treated as an alias for the corresponding symbol.


Wide character and string literals, octal and hex integer literals, and
integer literals with length and unsigned suffixes are accepted.


Output filename extensions are chosen following the `bison' C++ filename
conventions.


The attribute name `NIO' is only reserved if generating an evaluator with
support for building a visual representation of the parse tree. Declaring an
attribute named `NIO' is allowed, with a warning, otherwise.


Whitespace may occur within attribute occurrences and references.


The use of the symbols "%{" and "%}" to bracket a lexer rule action (`flex')
is accepted.




** Internals


The attribute decoration implementation was refactored so that only the
`yyyDecorate()' run-time function needs the added parameter(s) declared by
the
`%param' and/or `%parse-param' directive(s).


The lexer rules for recognition of directive and C/C++ type keywords were
replaced with perfect hash table lookups.


The new `bison' (as of 3.6) "%define parse.error custom" directive enables
use
of a custom syntax error message function, removing the need for skeleton
customization for this purpose.


Various code generation components were refactored and consolidated into a
new
`codegen' module.




** Bug fixes


The semantic stack entry corresponding to the `error' token is undefined, in
general, so (for now) that stack entry is explicitly ignored.


Empty C `struct' declarations are no longer generated from an `@attributes'
declaration consisting of only attributes of type `@void'. Some C compilers
don't accept empty `struct' types as member types in a C `union'.


The symbols "%{" and "%}" used to bracket literal code blocks in lexer
specifications must correctly start at the beginning of a source line.




** Documentation


The User Reference Manual was revised to match the release.


An explanation of the evaluator "pruning" memory optimization, generated by
default, and its interaction with the (discouraged) use of global variables
as
intermediate values in attribute value computations was added to the User
Reference Manual. Pruning can be suppressed using the "-d" command-line
option. Pruning is also suppressed if postdecoration traversals are defined.




** Test suite


Several test cases were updated to demonstrate the use of newly supported
extensions:
    - %define api.value.type union
    - %param {PARAMETER}
    - %define api.token.prefix {PREFIX}
    - %token TOKEN "literal string token"
    - whitespace within attribute references
    - use of "%{ ... %}" to bracket lexer rule actions
    - user-declared NIO attribute name


Post a followup to this message

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