Skip to content

Conversation

@ydah
Copy link
Member

@ydah ydah commented Dec 21, 2025

Motivation

When writing simple parser samples or prototypes, defining %union can be cumbersome and unnecessary. Bison allows users to generate parsers without the %union directive, defaulting YYSTYPE to int. This PR brings the same convenience to lrama for better Bison compatibility.

How it works

When %union is not defined:

  1. YYSTYPE defaults to int (same as Bison)
  2. Semantic value references are generated without union member access
  3. The parser works exactly like Bison-generated parsers

## Motivation

When writing simple parser samples or prototypes, defining `%union` can be cumbersome and unnecessary. Bison allows users to generate
parsers without the `%union` directive, defaulting `YYSTYPE` to `int`. This PR brings the same convenience to lrama for better Bison
compatibility.

## How it works

When %union is not defined:
1. YYSTYPE defaults to int (same as Bison)
2. Semantic value references are generated without union member access
3. The parser works exactly like Bison-generated parsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant