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

Grammar Templates for Expressions? #21

Open
DavePearce opened this issue Apr 13, 2015 · 2 comments
Open

Grammar Templates for Expressions? #21

DavePearce opened this issue Apr 13, 2015 · 2 comments

Comments

@DavePearce
Copy link
Member

Currently, the grammar used for describing Whiley statements and expressions is imprecise in certain ways. For example when describing the syntax for an if statement, the condition is defined as a generic Expr, when in fact it can only be a boolean expression.

The question is whether or not we can describe this and, if so, do we want to?

@DavePearce
Copy link
Member Author

One issue here is that making it a grammatical issue will affect what kind of error message is reported. For example, consider these two messages:

error: unexpected token encountered
if (1,2):
     ^

versus:

error: expected type bool, found (int,int)
if (1,2):
   ^^^^^

The former represents a grammatical error, whilst the latter represents a type error.

@DavePearce
Copy link
Member Author

One approach here would be to mix type and grammatical rules together. This might not be as crazy as it sounds, provided it was described properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant