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

Two confusions about language spec and ANTLR4 grammar #489

Closed
yunhailuo opened this issue Jan 6, 2022 · 7 comments
Closed

Two confusions about language spec and ANTLR4 grammar #489

yunhailuo opened this issue Jan 6, 2022 · 7 comments

Comments

@yunhailuo
Copy link
Contributor

I have two confusions about import and integer when comparing language spec v1.1 and its ANTLR4 grammar:

  1. The URI grammar defined in ANTLR4 grammar is string which supports expression placeholder and string interpolation. My reading on language spec is import URI should be just string literal Am I misunderstanding something here?
  2. The ANTLR4 lexer for integer literal doesn't seem to support octal or hex while the pattern in language spec seems to indicate they are supported. Am I reading them wrong?

I think @jdidion is an expert on this. Can you help me here a little? Thank you in advance.

@jdidion
Copy link
Collaborator

jdidion commented Jan 6, 2022

For #1 I think you are right, it should be changed to string literal.

For #2 look at https://github.com/dnanexus/wdlTools/tree/develop/src/main/antlr4. There are some fixes there I need to commit back to the openwdl repo.

@yunhailuo
Copy link
Contributor Author

Hi @jdidion , thank you very much for the quick reply. For int literal, I'm not sure if I missed the branch but I still see IntLiteral -> Digits -> Digit -> [0-9]

I'd like thank you again for this great work and ANTLR4 resource. Overall, I just want to kindly check if this is still some supported resource in the WDL community or are there some other plans for standardizing WDL spec/grammar.

For #1 I think you are right, it should be changed to string literal.

For #2 look at https://github.com/dnanexus/wdlTools/tree/develop/src/main/antlr4. There are some fixes there I need to commit back to the openwdl repo.

@jdidion
Copy link
Collaborator

jdidion commented Jan 6, 2022

Ah, you are right. I'll add that as an issue.

@yunhailuo
Copy link
Contributor Author

Ah, you are right. I'll add that as an issue.

Sounds great. Looking forward to your fix.

One more thing, I'm wondering if you have come across errors like the following when generating antlr4 parser @jdidion :

error(134): WdlV1_1Parser.g4:326:4: symbol struct conflicts with generated code in target language or runtime
error(134): WdlV1_1Parser.g4:50:18: symbol string conflicts with generated code in target language or runtime

In your upcoming fix, is it reasonable to change string to wdl_string and struct to wdl_struct?

@jdidion
Copy link
Collaborator

jdidion commented Jan 7, 2022

I think that's reasonable. We should probably collect all the reserved words across all the antlr runtimes and make sure there are no other collisions. Do you know of such a list?

@yunhailuo
Copy link
Contributor Author

I think that's reasonable. We should probably collect all the reserved words across all the antlr runtimes and make sure there are no other collisions. Do you know of such a list?

Good question but I don't really have a good list. Sorry. But practically speaking, I did try generate parser using antlr4 v4.9.3 against all available targets described here for all versions with antlr4 grammar which are 1.0, 1.1, development and draft-2. string and struct are the only two conflicts I found.

@jdidion
Copy link
Collaborator

jdidion commented Feb 6, 2024

Migrated to wdl-parsers repository: openwdl/wdl-parsers#2

@jdidion jdidion closed this as completed Feb 6, 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

2 participants