wdl icon indicating copy to clipboard operation
wdl copied to clipboard

Two confusions about language spec and ANTLR4 grammar

Open yunhailuo opened this issue 3 years ago • 6 comments

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.

yunhailuo avatar Jan 06 '22 05:01 yunhailuo

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 avatar Jan 06 '22 06:01 jdidion

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.

yunhailuo avatar Jan 06 '22 16:01 yunhailuo

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

jdidion avatar Jan 06 '22 17:01 jdidion

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?

yunhailuo avatar Jan 07 '22 05:01 yunhailuo

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?

jdidion avatar Jan 07 '22 05:01 jdidion

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.

yunhailuo avatar Jan 07 '22 06:01 yunhailuo

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

jdidion avatar Feb 06 '24 22:02 jdidion