check_start_symbol crashes on a grammar whose first element is a type annotation

Open Beginner friendly
#39 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
ocaml
Domain
compilers

Research direction

Start at lib/checkSolverAst.ml:27 and trace how CheckSolverAst.verdict_of and check_solver_ast handle the first grammar element. Reproduce the crash with ta_first.gbl and the shown term, then verify that checking the grammar returns a verdict instead of aborting, with an explanatory start-symbol message if appropriate.

Written by the indexing model from the issue text.

Description

lib/checkSolverAst.ml:27 handles A.TypeAnnotation _ :: _ with Utils.crash "Unexpected case in check_start_symbol", so checking a term against a grammar whose first element is a type annotation aborts instead of returning a verdict.

Repro

ta_first.gbl:

<G> :: Int;
<S> ::= <G>;

Generation works fine:

$ goblin --file ta_first.gbl
(S@{0}[0] (G 76))

But CheckSolverAst.verdict_of / check_solver_ast on that same term:

CRASH: Internal error: Unexpected case in check_start_symbol

Notes

  • Pre-existing: crashes identically on 9c1f1e9.
  • Worth fixing now that verdict_of is exported and load-bearing (it is the oracle used by the mutation corpus). A crash cannot be distinguished from a rejection by callers, and the mutation harness swallows exceptions, so a grammar in this shape would silently drop out of the corpus.
  • Returning Violated/Unknown with a message about the start symbol would be enough. Related: #30, on expect-failure tests not distinguishing crashes from graceful errors.
Dominant language
OCaml
Stars
0
Forks
1
Avg merge
1h 57m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

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.

More from lorchrob/Goblin

All issues in lorchrob/Goblin

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.