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

trconvert documentation error #392

Open
arpieb opened this issue Dec 19, 2023 · 1 comment
Open

trconvert documentation error #392

arpieb opened this issue Dec 19, 2023 · 1 comment

Comments

@arpieb
Copy link

arpieb commented Dec 19, 2023

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).

@kaby76
Copy link
Owner

kaby76 commented Dec 27, 2023

Thanks for the comments.

Many conversions in trconvert are not implemented. Each conversion would have had to be hand programmed in C#, and I only wrote a few. But, I want to have something that is a little more open. So, my plan is to write conversions as scripts. An example is the one for bison.

I'm not sure how Trash scripts would be published though. It should be easily accessible through the command line, and not dependent on Bash.

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