Skip to content

Add ST Grammar#1

Draft
simoes-tiobe wants to merge 5 commits into
mainfrom
PR/Grammar
Draft

Add ST Grammar#1
simoes-tiobe wants to merge 5 commits into
mainfrom
PR/Grammar

Conversation

@simoes-tiobe

Copy link
Copy Markdown

Add ST Grammar

Several places where the IEC grammar reduces a bare identifier through
multiple aliased or overlapping rules (type vs. function-block names,
derived type-name variants, access-path segments) are genuinely
ambiguous from syntax alone - which one applies is only decidable with
a symbol table - so those spots are collapsed onto the existing shared
`type_name`/`symbolic_variable` rules instead, deferring the
distinction to a later semantic pass.

Other conflicts are fixed more locally:
- signed_integer/real_literal fold their optional sign into the token
  regex so tree-sitter's longest-match lexing picks them over a bare
  unary-minus operator.
- bit_string_literal requires its type prefix, since an unprefixed
  integer was ambiguous with a plain integer literal.
- character_string (used where no STRING/WSTRING keyword disambiguates)
  is now a single unaliased rule instead of a single-vs-double-byte
  choice that shared the same delimiter and representation set.
- param_assignment's `NOT var_name => var` vs. unary_operator's
  `NOT expr` is a genuine local ambiguity (resolvable with more
  lookahead, not by restructuring), so it's handed to GLR via
  `%conflicts`.

Also drops fb_name_decl, made dead by the type_name consolidation.
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