antlr / antlr/antlr4

Regarding expecting next grammar rules

Open
#2,276 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
19k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

Hello,
I am new to writing antlr4 grammar. I have written this sentence.
gby : 'by' cn+ hvg? ;

Testing rules:
line 1:0 mismatched input '' expecting 'by'
input: by
line 1:2 missing 'CN' at ''
input: by CN
but after inputing by CN I don't get expecting "hvg" as a suggestion because of "?" sign. But I want to get suggestion for "hvg". It would be great if anyone tells me how can I get this suggestion.
Thank in advance.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the grammar rule `gby : 'by' cn+ hvg? ;` and reproduce the reported inputs `by` and `by CN`. Read the parser's handling of optional rules and expected-token error reporting; done means determining whether an `hvg` suggestion is supported and documenting the applicable behavior or change needed.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.