ForNeVeR / ForNeVeR/Cesium

Get rid of parser hacks related to typedefs and identifiers

Open
#107 2 comments 0 reactions 0 assignees View on GitHub
area:parser kind:refactor status:blocked
Dominant language
C#
Stars
451
Forks
49
Avg merge
13h 59m
Merged PRs (30d)
6

Description

In the C17 standard, a common pair of AST nodes which are frequently used together are `declaration_specifiers` and something involving an `identifier` next.

Some examples are (Yoakke syntax, not direct EBNF from the standard):
- `declaration: declaration_specifiers init_declarator_list? ';'`
- `struct_declaration: specifier_qualifier_list struct_declarator_list? ';'` (where `specifier_qualifier_list` includes some of the `declaration_specifiers`)

The problem is that `declaration_specifiers` (or, say, `specifier_qualifier_list`) include an item called `typedef_name`, which it is: a name of a `typedef` item.

This causes Cesium to choke on simple definitions such as `size_t foo`: was it `typedef_name: size_t` and `typedef_name: foo`, or `typedef_name: foo` and `identifier: foo`?

Ideally, a parser should be able to choose in most contexts, since the former isn't even valid. But due to Yoakke issue https://github.com/LanguageDev/Yoakke/issues/138, currently we have to support a great number of workarounds to be able to parse even the simplest of cases.

Current plan is to wait for the Yoakke issue to get resolved, and then remove all the hacks from the code.

To find all of these hacks, look for marks like `TODO[#107]`.

**Blocked on:**
- [ ] https://github.com/LanguageDev/Yoakke/issues/138

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.