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

OpenMP Syntax Checking #52

Open
yanyh15 opened this issue Jun 18, 2019 · 2 comments
Open

OpenMP Syntax Checking #52

yanyh15 opened this issue Jun 18, 2019 · 2 comments
Assignees
Labels
high priority high priority

Comments

@yanyh15
Copy link
Member

yanyh15 commented Jun 18, 2019

OpenMP has lots of restrictions and rules in each directive and clause. A full syntax checking requires detailed work for each directive and clause. I am proposing that we apply the following strategies:

  1. If we can use the lexer and grammar rules to apply restrictions and rules that are straightforward, we will use lexer and grammar rules
  2. For more complicated checking that involve only one clause type, e.g. syntax checking can be performed when adding the clause information to the directive object. E.g. single-use restriction for if, num_threads, ... clauses can be checked when adding the clause.
  3. For those checking that needs to involve multiple clauses and can only be performed after the whole directive is parsed, we will need to do that after parsing the whole directive. E.g. the use of if and other clauses in the combined directive, a clause that must exist for a directive.
  4. Syntax checking that involves language-specific expression and identifiers are very limited due to the nature of the parser. The simple checking can be done is to check whether two variables are used in two places that are conflict, e.g. shared(avar) private(avar). This is incorrect use of avar and can be checked by simply comparing the strings of the occurence of the variable.
  5. Full semantics checking should be done by the integrating compiler
@chunhualiao
Copy link
Contributor

@yanyh15 I think this is best to be done on top of ROSE's OpenMP AST, which has all the info. you need for semantics checking. Otherwise, you have to encode hierarchical info in your parser's AST first.

@yanyh15 yanyh15 changed the title Syntax and Semantics Checking OpenMP Syntax and Semantics Checking Jun 21, 2019
@yanyh15 yanyh15 changed the title OpenMP Syntax and Semantics Checking OpenMP Syntax Checking Jun 21, 2019
@yanyh15
Copy link
Member Author

yanyh15 commented Jun 21, 2019

@chunhualiao I updated the issue, I think i meant syntax checking, though there are some semantics restriction in the spec for some directives.

For OpenMP syntax checking, this should be done in ompparser. I would like ompparser to have capability of checking the restrictions and rules applied by the language spec. After parsed successfully by ompparser, it is a legal OpenMP directive, thus requiring no checking from the integrating compiler. Semantics checking by the compiler will be much simpler as well.

@yanyh15 yanyh15 added high priority high priority and removed high priority high priority labels Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority high priority
Projects
None yet
Development

No branches or pull requests

5 participants