openwdl / wdl

Workflow Description Language - Specification and Implementations
https://www.openwdl.org/
BSD 3-Clause "New" or "Revised" License
768 stars 307 forks source link

Two confusions about language spec and ANTLR4 grammar #489

Closed yunhailuo closed 8 months ago

yunhailuo commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

yunhailuo commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 8 months ago

Migrated to wdl-parsers repository: https://github.com/openwdl/wdl-parsers/issues/2