Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undescriptive runtime error when well-formedness with a symbol table entry fails #140

Open
xFrednet opened this issue Sep 16, 2024 · 0 comments

Comments

@xFrednet
Copy link

I have a well-formedness similar to this:

inline const trieste::wf::Wellformed flatten =
    (Top <<= File)
    | (File <<= (Label | Print)++)
    | (Label <<= Ident)[Ident];
    ;

Notice that the Label node has an identifier which should be added to the symbol table.

A rewrite rule returned something like this:

return Seq << (Print ^ " (True)")
           << (Label ^ "else:") << (Ident ^ else_label)
           << (Print ^ "(False"));

The label construction is incorrect, as I was missing parentheses to add the Ident as a Child of Label.

I expected the well-formedness to fail. Instead, I got the following undescriptive runtime error:

terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
Aborted (core dumped)

Ideally, it should just throw the usual error about the well-formedness error

@xFrednet xFrednet changed the title Undescriptive runtime error when well-formedness with a *symbol table entry* fails Undescriptive runtime error when well-formedness with a symbol table entry fails Sep 16, 2024
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

No branches or pull requests

1 participant