drforr / perl6-antlr4 Goto Github PK
View Code? Open in Web Editor NEWParser for ANTLR4 grammar
Parser for ANTLR4 grammar
heyo, you (probably accidentally) uploaded a .precomp folder inside the lib folder
Using the package's example file "antlr2perl6" over the file InputFormLexerRules.g4, I got the following error:
Unknown type, this should not get triggred
in method to-lines at /Applications/Rakudo/share/perl6/site/sources/04CF9BA541DE71DF8E77833BA483DE2123FD57EC (ANTLR4::Grammar) line 63
in method file-to-string at /Applications/Rakudo/share/perl6/site/sources/04CF9BA541DE71DF8E77833BA483DE2123FD57EC (ANTLR4::Grammar) line 226
in sub MAIN at ./antlr2perl6 line 6
in block <unit> at ./antlr2perl6 line 2
I just comment out in InputFormLexerRules.g4 the lines:
options{
//We put target-language dependent code in a base class.
superClass=LexerBase;
}
and I was able to proceed.
(For more details see https://github.com/antononcube/Raku-Mathematica-Grammar .)
I find this a really great and impressive module and was amazed that it could directly generate a syntactically correct Perl6 grammar for a large ANTLR4 grammar (I took the golang grammar from the example grammars repo, moved the grammar and lexer into one file and removed the extra function calls by requiring statements to be semicolon-terminated). While that grammar still works with ANTLR4, I get seemingly endless loops in the Perl6 grammar. Are there any simple steps for me to mechanically rewrite the Perl6 grammar manually so that it runs in a reasonable time?
Here's the grammar and example input text I've used.
I am not able to figure out whether this is a perl6 target for Antlr4 or a module that takes a .g4 file and converts it to a perl6 grammar file.
A complete example in the perldoc using the default hello.g4 example would help in understanding the intent and usage of the module.
t/meta.t (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=5, Tests=69, 44 wallclock secs ( 0.07 usr 0.00 sys + 31.79 cusr 0.34 csys = 32.20 CPU)
Result: FAIL
# license ‘Artistic’ is not one of the standardized SPDX license identifiers.
# please use use one of the identifiers from https://spdx.org/licenses/
# for the license field or if your license is not on the list,
# include a URL to the license text as one of the 'support' keys
# in addition to listing its name.
# Failed test 'License is correct'
# at /home/cpan/.zef/store/Test-META.git/89a354323648cd4db71418f52a963cbaa4621898/lib/Test/META.pm (Test::META) line 98
# Looks like you failed 1 test of 8
# Failed test 'Project META file is good'
# at /home/cpan/.zef/store/Test-META.git/89a354323648cd4db71418f52a963cbaa4621898/lib/Test/META.pm (Test::META) line 75
# Looks like you failed 1 test of 1
Hi,
I found your module last week and it is awesome! It's a pitty that it seemed to have stopped working
after glr. I tried to fix it, but I stumbled from on error to the next and finally started from scratch. However I kept your great layout and ideas (which saved me lots of lots of time).
If you have time you might want to take a look at my fork and tell me if this is something that you would pull, or tell me if there is anything that you would like to be changed first.
I didn't keep the syntax format because my editor made it quite difficult for me to keep it and I admit
that I was too lazy to make changes in that area. If this is something that concerns you I could also
change it.
Thanks for starting this project!
All the best,
Bernhard
As per the title.
It seems many other ones inside the corpus folder do not get converted either.
Is it a known issue?
Using the latest rakudo-star 2017/07 with the corpus/SQLite.g4
I get the following output:
Shouldn't happen, please report this error.
in method atom at /Applications/Rakudo/share/perl6/site/sources/9F044BB3D7CFF2128EF7C874EB947D3A35197719 (ANTLR4::Actions::AST) line 272
in regex atom at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 473
in regex element at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 423
in regex parserElement at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 418
in regex blockAltList at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 413
in regex block at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 502
in regex ebnf at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 438
in regex element at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 423
in regex parserElement at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 418
in regex parserAlt at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 345
in regex parserAltList at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 340
in regex parserRuleSpec at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 278
in regex ruleSpec at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 273
in regex TOP at /Applications/Rakudo/share/perl6/site/sources/C257D4AC347E4280F89BBBFC889919D8ADA9061A (ANTLR4::Grammar) line 166
in method parsefile at /Applications/Rakudo/share/perl6/site/sources/FF59F8064BDEE33A2BE4E1992D9F0BC64B5C008E (ANTLR4::Actions::Perl6) line 194
in sub MAIN at antlr2perl6 line 7
in block <unit> at antlr2perl6 line 4
By comparison, CSharp4.g4 seems to work fine.
Hi,
My perl6 version is :
This is Rakudo version 2017.07 built on MoarVM version 2017.07
Trying to install perl6-ANTLRR4, doing : panda update && panda install ANTLR4, I'm getting the following error
...
Result: PASS
==> Installing JSON::Tiny
JSON::Tiny:ver<*>:auth<>:api<> already installed
in any at /root/rakudo-star-2017.07/install/share/perl6/site/precomp/531476C94944C40F030060AEB60539343668769B.1501425692.30551/58/582CB7486602954A4601BDCE5A0EAC54B05DA58A line 1
in block at /root/rakudo-star-2017.07/install/share/perl6/site/resources/E0D978079BB5081DE986D058BB8AB08252F05CC8 line 23
in sub MAIN at /root/rakudo-star-2017.07/install/share/perl6/site/resources/E0D978079BB5081DE986D058BB8AB08252F05CC8 line 20
in block at /root/rakudo-star-2017.07/install/share/perl6/site/resources/E0D978079BB5081DE986D058BB8AB08252F05CC8 line 166
in sub MAIN at /root/rakudo-star-2017.07/install/share/perl6/site/bin/panda line 2
in block at /root/rakudo-star-2017.07/install/share/perl6/site/bin/panda line 2
Any idea ?
Thanks for your help.
Best Regards,
JP
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.