Domemtech.Trash icon indicating copy to clipboard operation
Domemtech.Trash copied to clipboard

trconvert documentation error

Open arpieb opened this issue 2 years ago • 1 comments

First off, thanks for the incredible suite of tools here; really looking forward to leveraging them when/where I can on projects. Not sure if this was an older feature, but the following example in the trconvert documentation is not valid:

trparse Abnf.g4 | trconvert -t lark | trprint > Abnf.lark

Also tried with trtext as suggested in another issue, the result is still a JSON parsing exception. Attempting to run just the conversion returns the following:

$ trparse Abnf.g4 | trconvert -t lark
CSharp 0 Abnf.g4 success 0.077624
Unhandled conversion to.
[]

$ trconvert --version
trconvert 0.21.16

Testing just trparse I get a full JSON dump of the IR for the grammar, which seems to indicate it's not a problem parsing the Antlr4 grammar:

$ trparse Abnf.g4 | json_pp | head
CSharp 0 Abnf.g4 success 0.081734
[
   {
      "ChannelNames" : [
         "DEFAULT_TOKEN_CHANNEL",
         "HIDDEN",
         "OFF_CHANNEL",
         "COMMENT"
      ],
      "FileName" : "Abnf.g4",
      "IdentityOfLexer" : "ANTLRv4Lexer.g4",

AFAICT there is no conversion path from Antlr4 to Lark in the code. The docs need to be updated to provide a working example, and if possible maybe a listing of the supported conversion paths?

FWIW, running on macOS 14.2 (Intel).

arpieb avatar Dec 19 '23 15:12 arpieb