Re: Help on Marpa fails

2022-04-30 Thread 'Jeffrey Kegler' via marpa parser
Good answer, Lukas, thanks! -- jeffrey Sent with ProtonMail secure email. --- Original Message --- On Saturday, April 30th, 2022 at 4:27 AM, Lukas Atkinson wrote: > Your grammar does not allow the list in that location. Here is the > relevant excerpt: > > ``` > :start ::= language

Re: Newbie question on events

2022-04-26 Thread Jeffrey Kegler
Oops, I meant to type Lukas. Sorry. But anyway, thanks, thanks, thanks! On Tuesday, April 26, 2022 at 12:12:50 PM UTC-4 Jeffrey Kegler wrote: > Lucas, thanks for the excellent answer! > > To re-emphasize one of your points. In general, when designing a > Marpa::R2 application,

Re: Newbie question on events

2022-04-26 Thread Jeffrey Kegler
Lucas, thanks for the excellent answer! To re-emphasize one of your points. In general, when designing a Marpa::R2 application, use actions when possible, and events when necessary. On Tue, Apr 26, 2022 at 5:01 AM Lukas Atkinson wrote: > On Tue, 26 Apr 2022 at 02:00, Rk wrote: > > When does

Re: How to "trap" unacceptable lines.

2022-02-21 Thread Jeffrey Kegler
I have attached a reworked version, which I have tested. A few comments: 1.) In your version you had a long JUNK lexeme which slurped up the entire line. Marpa uses LATM lexing (Longest Acceptable Token Matching). JUNK would usually be longest, meaning the parser would usually see nothing else

Re: How to "trap" unacceptable lines.

2022-02-21 Thread 'Jeffrey Kegler' via marpa parser
[here](https://metacpan.org/dist/Marpa-R2/view/pod/Semantics/Rank.pod) to a > bare minimum ending up with the attached > > but the test strings get caught as "JUNK". (The first 'a = 1', is > acceptable.) Obviously I'm missing something! > > On Mon, Feb 21, 2022 at 12:

Re: How to "trap" unacceptable lines.

2022-02-21 Thread Jeffrey Kegler
One matter which requires getting used to with Marpa is that you are working with BNF, so the core logic is non-procedural. This is why most programmers seem to want to suffer endlessly with recursive descent rather than consider stronger parsers. You can understand recursive descent with purely

Re: Oops!

2020-12-03 Thread Jeffrey Kegler
cted); > } > } else { > say $recce->show_progress; > PARSE_ERROR($input, $recce->pos, $recce->terminals_expected); > } > } > > > Thanks! > - Dean > > > > On 12/2/20 7:32 PM, Jeffrey K

Re: Oops!

2020-12-02 Thread Jeffrey Kegler
rejects LHS token, pass the failure on to the user. On Wednesday, December 2, 2020 at 7:05:37 PM UTC-5 due...@gmail.com wrote: > > No problem, thanks for trying. I did plug it in and indeed got the same > results. > > > On 12/2/20 6:41 PM, Jeffrey Kegler wrote: > >

Oops!

2020-12-02 Thread Jeffrey Kegler
at 5:55:24 PM UTC-5 Jeffrey Kegler wrote: > How many commands? One approach that I just thought of and have never > tested is to have fixed length variables, prioritized versus the commands > of that length. > > Off the top of my head: > > var2 ~ priority=>1 > PA

Re: Preferring a shorter token match

2020-12-02 Thread Jeffrey Kegler
t; the rest as an expression - which follows more reasonable rules that the > LATM will like. > > So, I guess this falls to the "handled in easier faster ways" approach > which I guess should have been obvious but I failed to think of. > > Thank you for your time,

Re: Preferring a shorter token match

2020-12-02 Thread Jeffrey Kegler
I'll first describe your immediate problem, then ask a couple Q's. The problem: Lexing is LATM -- *Longest* Acceptable Token Matching. The lexeme priority is a tie breaker, used when tokens are the same length. When your grammar fails, "PAx" is your longest token, and the only choice at length

Re: Using Marpa in a project helping to translate the documentation

2020-04-23 Thread Jeffrey Kegler
I would certainly address the problem using Marpa, but I'm kinda biased. :-) >From what I read, you do *not* need to capture any nesting of blocks. RNS's parser doesn't do that so it might make a fine start. (I've never used it.) You don't need to produce a full AST, it seems, so the following

Re: precedence rules vs. ambiguity

2020-02-13 Thread Jeffrey Kegler
Thank you for your interest in Marpa, your kind words, your interesting example and your careful write-up of it. Briefly, precedenced statements work by applying precedence and associativity to instances of the LHS symbol on their RHS. In the 2nd example, occurs outside of the precedenced

Re: Panini parser & SPPF

2019-10-26 Thread Jeffrey Kegler
led partial parses, which won't be a part of the full parse. I'm doing > this traversal with a mark-and-sweep algorithm similar to the ones used in > GC, or mark-and-ignore. Online sort is done with a simple binary (max-)heap. > > Jeffrey Kegler remarked that he didn't achieve mathematical s

Re: Want to use ala Marpa in my compiler on C++ and Ya so in search for ala Marpa Parser generator in C C++ Java C#... without any Perl

2019-10-13 Thread Jeffrey Kegler
, Oct 13, 2019 at 4:41 PM Pavel Senatorov wrote: > ;) + after looking into libmarpa sources I want to read the English > description of the Marpa alg with all alg details yet without tech=code > details (ala used libs). > > Does it exist? Where? > > On 2019-10-13 21:45, Jeffrey K

Re: Want to use ala Marpa in my compiler on C++ and Ya so in search for ala Marpa Parser generator in C C++ Java C#... without any Perl

2019-10-13 Thread Jeffrey Kegler
Good luck with the Ya language! On Sun, Oct 13, 2019 at 5:28 AM e...@ya-lang.com wrote: > I'm creating PL Ya (http://Ya-Lang.com) and to parse it want to try smth > similar to Marpa alg... and inside C++ world the Perl is better to avoid... > But how in case of Marpa? > > -- > You received this

"Infinite Lookahead and Ruby Slippers"

2019-06-03 Thread Jeffrey Kegler
I just uploaded a new blog post: "Infinite Lookahead and Ruby Slippers" . It is a relatively simple example that packs in a lot about the various parsing strategies available in Marpa. The context is comment

"Sherlock Holmes and the Case of the Missing Parsing Solution"

2019-04-01 Thread Jeffrey Kegler
My newest blog post is "Sherlock Holmes and the Case of the Missing Parsing Solution" . I wanted to explain why my "Timeline" takes the approach it does and wound up dragging in Holmes and Einstein. :-) --

Re: Parsing Timeline Suggestions

2019-04-01 Thread Jeffrey Kegler
any people might share this > opinion. > > The way I tend to perceive "timelines" and other "histories" is as somewhat > authoritative and unbiased — at least, that's the platonic ideal. Think > about > the standard that Wikipedia tries to enforce for insta

Re: Parsing Timeline Suggestions

2019-03-29 Thread Jeffrey Kegler
. Not too much longer, I hope. Thanks, jeffrey On Wednesday, February 27, 2019 at 10:12:52 PM UTC-5, Jeffrey Kegler wrote: > > Your PEG work should be interesting and I plan to follow it. You made > quite a number of other significant (non-PEG) points and I am aware that I > s

Re: Parsing Timeline Suggestions

2019-02-27 Thread Jeffrey Kegler
iting to me. I'd love to recommend it and advertise it, but I find the > bias > towards the end prevents me to do so. I think many people might share this > opinion. > > The way I tend to perceive "timelines" and other "histories" is as somewhat > authoritative

Re: Parsing Timeline Suggestions

2019-02-19 Thread Jeffrey Kegler
Thanks for your kind words. In this, I'll just respond to the PEG points. That part of my timeline has caused more blowback than any other part, not unexpectedly. The quips are aimed, not at people like yourself who, while PEG optimists, know its difficulties and do not mislead others.

Re: Simple language benchmarks -- marpa vs handcrafted parser with regexes

2019-02-18 Thread Jeffrey Kegler
I hope we have helped. Even if you do go with just regular expressions, perhaps having a BNF arrow in the quiver will be useful for other things. On Mon, Feb 18, 2019 at 11:40 AM wrote: > > > If it's a contest of Marpa vs. regular expressions, I'm only surprised >> that it is just 3x. If your

Re: Simple language benchmarks -- marpa vs handcrafted parser with regexes

2019-02-18 Thread Jeffrey Kegler
If it's a contest of Marpa vs. regular expressions, I'm only surprised that it is just 3x. If your grammar parses using regular expressions, regular expressions will always be much faster. A while ago I wrote a post with a section on "When NOT to use Marpa". There were 4 cases and grammars that

Re: Marpa::R2 8.000000 is out

2018-12-26 Thread Jeffrey Kegler
lib/arch/auto/Marpa/R2/R2.so > -rwx--1 root system 1176733 Dec 26 12:07 > /tmp/ITM_Audit_Scripts/Marpa-R2-8.00/blib/arch/auto/Marpa/R2/R2.so > root@czapms22 /tmp/ITM_Audit_Scripts/Marpa-R2-8.00 > > > > > > On Thursday, December 27, 2018 at 2:19:23 AM

Re: Marpa::R2 8.000000 is out

2018-12-26 Thread Jeffrey Kegler
blib/arch/auto/Marpa/R2/R2.so(), > but a runtime definition > # of the symbol was not found. > # rtld: 0712-001 Symbol _marpa_t_nook_is_cause was referenced > # from module > /tmp/ITM_Audit_Scripts/Marpa-R2-8.00/blib/arch/auto/Marpa/R2/R2.so(), > but a runtime d

Marpa::R2 8.000000 is out

2018-12-17 Thread Jeffrey Kegler
I have uploaded a new indexed release of Marpa::R2: 8.00: https://metacpan.org/pod/distribution/Marpa-R2/pod/Marpa_R2.pod It fixes a bug, which under unusual circumstances caused the integer arguments of $recce->resume() or $recce->lexeme_complete() to be ignored. -- You received this

Re: I have uploaded a release candidate for Marpa::R2 8.000000

2018-12-11 Thread Jeffrey Kegler
would google need to > find it? > > Thanks, > David Whitten > 713-870-3834 > > On Monday, December 10, 2018 at 12:40:40 PM UTC-5, Jeffrey Kegler wrote: > >> I have uploaded a new release candidate for Marpa::R2: >> https://metacpan.org/pod/release/JKEGL/Marpa-R2-7

I have uploaded a release candidate for Marpa::R2 8.000000

2018-12-10 Thread Jeffrey Kegler
I have uploaded a new release candidate for Marpa::R2: https://metacpan.org/pod/release/JKEGL/Marpa-R2-7.001_000/pod/Marpa_R2.pod . This is the release candidate for Marpa::R2 8.00, which I hope to release next week. Value added is the fix to the SvIOK problem, as summarized here:

Re: Marpa::R2 6.000000 is out

2018-12-03 Thread Jeffrey Kegler
Thanks. I passed your report on to the IRC channel. On Mon, Dec 3, 2018 at 4:46 PM Ron Savage wrote: > It installed without problems at home, and all my modules pass their > combined 2112 tests. > > -- > You received this message because you are subscribed to the Google Groups > "marpa parser"

Marpa::R2 6.000000 is out

2018-12-03 Thread Jeffrey Kegler
Marpa::R2 6.00 is now out. It has some better error messages, and documentation improvements. -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails

Announcing a release candidate for Marpa::R2 6.000000

2018-11-26 Thread Jeffrey Kegler
I have released Marpa::R2 5.045_000: https://metacpan.org/release/JKEGL/Marpa-R2-5.045_000 . This is a release candidate for Marpa::R2 6.00, so you may want to test it in advance. Testing looks excellent, but you never know. :-) The major value added is better error messages and

Re: Earley complexity over grammar size

2018-11-01 Thread Jeffrey Kegler
Forgive me if I'm overexplaining -- you obviously know a lot of these matters, but any over-explanations will help other readers, so I hope you'll be patient with them. Quibble 1: "Complexity" since the 60s has usually referred to results in terms of Landau (big-O) notation. These are only

Re: Recognizer interface change in R2?

2018-10-23 Thread Jeffrey Kegler
Wednesday, October 24, 2018 at 7:44:27 AM UTC+5:30, Jeffrey Kegler > wrote: >> >> Looks like you're running 2.086.000 which is really old, 2014-06-01. The >> current stable in 4.000.000 (March 2017). >> >> On Tue, Oct 23, 2018 at 9:54 PM Thomas Weigert >> wrote:

Re: Recognizer interface change in R2?

2018-10-23 Thread Jeffrey Kegler
Looks like you're running 2.086.000 which is really old, 2014-06-01. The current stable in 4.000.000 (March 2017). On Tue, Oct 23, 2018 at 9:54 PM Thomas Weigert wrote: > Per the Docu, the recognizer setting "rejection" can be used by any > recognizer setting-aware method, and "new" is one of

Announcement of Parsing Timeline 3.1

2018-10-15 Thread Jeffrey Kegler
My newest blog post is my announcement of my "Parsing: a Timeline", version 3.1 . "It is a painless introduction to a fascinating and important story

New blog post: "Measuring Language Popularity

2018-10-03 Thread Jeffrey Kegler
My new blog post is "Measuring Language Popularity" . Current measures of language popularity are more than a little rough. Would better parsing help? -- You received this message because you are

"A Haskell challenge"

2018-08-28 Thread Jeffrey Kegler
"A Haskell challenge" is my most recent blog post. Michael Arntzenius pointed out that Haskell's native parsers have trouble with its list comprehension syntax, and wondered if Marpa could do better. It can.

New blog post: "Marpa and combinator parsing 2"

2018-08-21 Thread Jeffrey Kegler
I've just put up a new blog post, "Marpa and combinator parsing 2" . It describes an implementation of Marpa-driven combinator parsing. The application is whitespace-significant parsing, using the layout

Re: Rule ordering question

2018-08-08 Thread Jeffrey Kegler
his a >> vote for early bailing (Earley bailing?) in R3. >> >> Mike >> >> On Wednesday, August 8, 2018 at 1:40:47 PM UTC-5, Jeffrey Kegler wrote: >>> >>> It make *lots* of sense and I've considered it as a feature in R3. It >>> will never

Re: Rule ordering question

2018-08-08 Thread Jeffrey Kegler
It make *lots* of sense and I've considered it as a feature in R3. It will never happen in R2 -- it'd be a massive risky change and R2 is stable. Incidentally, a limited implementation of it is how LATM lexing works. As a special case, I selectively turn on and off predictions in Earley set 0

Re: Finding where a rule matches input stream

2018-08-06 Thread Jeffrey Kegler
The interface here is a series of layers that grew over the history of R2 -- there never really was any design so conventions change between each call. In other words, it's a mess. The emphasis in R2 is on backward compatibility so, alas, it won't improve. In R3 I redesigned G1 locations and

Re: Finding where a rule matches input stream

2018-08-03 Thread Jeffrey Kegler
t; which incorrectly outputs > >> location() is (1, 2) >> g1_location_to_span is (0, 5) >> literal is # >> but $_[1] shows this id rule matched abc >> >> Fortunately, the more complicated solution from my previous post is > working, so I'm not blocke

"Parsers and useful power"

2018-05-14 Thread Jeffrey Kegler
My new blog post "Parsers and useful power" looks at the 1960s contest between the Irons parser, the first ever published, and recursive descent. One of those is very much with us today, and one

Re: Version 3 of "Parsing: a Timeline"

2018-04-17 Thread Jeffrey Kegler
ee your responses to some of the questions and omissions pointed out there. > > Fantastic reading, by the way. I particularly enjoy > just-opinionated-enough-to-be-interesting surveys like this :-) > > Zellyn > > > On Tuesday, April 10, 2018 at 11:54:02 AM UTC-4, Jeffrey Kegler

Version 3 of "Parsing: a Timeline"

2018-04-10 Thread Jeffrey Kegler
I have written version 3 of my most popular blog post: "Parsing: A Timeline" . There are enough changes that it could be considered a new work. It is several times as long, and includes sources. The previous versions focused entirely on

Re: Input System and Parse Events

2018-03-29 Thread Jeffrey Kegler
I have limited Internet access so must be brief. Suggest look at Marpa::R3. In particular input and event models much changed and improved. On Mar 28, 2018 10:40 PM, "Andreas Kupries" wrote: > > Having completed a first larger example using Marpa/Tcl [4] the next > example I

Re: why is this string not recognized? trouble with complex L0 and quotes, I think.

2018-02-20 Thread Jeffrey Kegler
quoted and >> unquoted segments, where the quoted segments were allowed to contain spaces >> (see CHAR_INSIDE_SQUOTES and CHAR_INSIDE_DQUOTES), but the unquoted >> segments were not (see CHAR_UNQUOTED). >> >> Anyway, I will give your suggestion a try. >> >&

Re: why is this string not recognized? trouble with complex L0 and quotes, I think.

2018-02-19 Thread Jeffrey Kegler
[ This is off the top of my head and untested. ] SubLevelOptions, despite its name, only allows for one sublevel option. You perhaps want something more like: SublevelOptionsMaybe ::= SublevelOptions SubLevelOptions ::= SubLevelOption+ SublevelOptionsMaybe ::= SublevelOption ::=

"About me"

2018-01-24 Thread Jeffrey Kegler
dge levels are only thoughts -- Patreon allows contributions of all sizes. I've already received a lot of wonderful support from the Marpa community in terms of volunteer time. Money has become important and will be going forward, but I want to emphasize how grateful I am to those who contribute tim

Re: Are there good strategies for diagnosing performance issues?

2017-11-21 Thread Jeffrey Kegler
@amon: A very nice summary. Thanks! @mdorman: At this point many people have more & more recent experience with Marpa::R2 applications than I do. [ Though I still know the internals better than anyone, I guess. :-) ] amon is an expert, and also the author of some very good tutorials. On Tue,

Re: Are there good strategies for diagnosing performance issues?

2017-11-21 Thread Jeffrey Kegler
t; So just to confirm, generating an event (thus requiring processing and > $recce->resume()) is part of this cost, yes? > > > > Michael Dorman > > > > *From:* marpa-parser@googlegroups.com [mailto:marpa-parser@ > googlegroups.com] *On Behalf Of *Jeffrey Kegler > *Sent

Re: Are there good strategies for diagnosing performance issues?

2017-11-20 Thread Jeffrey Kegler
I'm very rusty at looking at profiles of Marpa::R2, but I hope some off-the-top-of-my-head remarks might be useful. Typically, almost all the time of an R2 parse is taken up by the Perl layer, and by the semantics -- the parse itself is almost free. So looking at how you handle the semantics may

Re: Is it possible to match copy'n'paste of Java stacktrace with Marpa?

2017-11-14 Thread Jeffrey Kegler
element), but can it be used > to remove lexem(?) and retry parse (with "\n" removed)? > > On Monday, 13 November 2017 22:53:37 UTC+1, Jeffrey Kegler wrote: >> >> [...] >> >> Repairing broken stack traces is interesting. If I were pursuing it, I'd >&

Re: Earley Algorithm things and Marpa things

2017-11-12 Thread Jeffrey Kegler
extend, I think various > grammar-design rules go a long way to reducing the possibility of > exponential run-time (and space). > > On Sun, Nov 12, 2017 at 8:45 PM, Jeffrey Kegler < > jeffreykeg...@jeffreykegler.com> wrote: > >> With respect to time complexity, the qu

Re: Earley Algorithm things and Marpa things

2017-11-12 Thread Jeffrey Kegler
> > With respect to time complexity, the question is that the parse time is > 2.4 or cubic with respect to exactly what? The tradition is to measure time with respect to n, which n is the length of the input in characters of some alphabet, and the time only includes parsing time, not evaluation

Re: Earley Algorithm things and Marpa things

2017-10-28 Thread Jeffrey Kegler
Re Marpa and AH, you might want to look at this earlier reply: https://groups.google.com/d/msg/marpa-parser/eKSSioagswU/uKm_AgxGAQAJ In creating Marpa, I may have acquired as much experience with the AH algorithm as anybody, possible even Aycock/Horspool themselves. I found the special LR(0)

Re: Marpa::R2 and new PPI

2017-10-12 Thread Jeffrey Kegler
lace. I had increased the ulimit -m to 1 gig on general suspicion. > > The capture end point problem appears to be > > t/perl.t (Wstat: 65280 Tests: 0 Failed: 0) > > Non-zero exit status: 255 > > Parse errors: Bad plan. You planned 12 tests but ran 0.

Re: Aycock-Horspool and Marpa

2017-09-30 Thread Jeffrey Kegler
repeating your reply to the group. I have two follow-up > questions inline below: > > On Sunday, September 24, 2017 at 5:19:44 PM UTC-7, Jeffrey Kegler wrote: >> >> In addition to AH, a few papers have described ways to reduce the number >> of Earley items, but

Aycock-Horspool and Marpa

2017-09-24 Thread Jeffrey Kegler
i was recently asked about a possible extension of the Aycock-Horspool method. In reply I noted that Marpa no longer uses Aycock-Horspool items, and gave the reasons: I used the AH items, but eventually decided to go back and rip them out. I discovered they bought little or nothing in terms

Re: Rewrite Marpa in ....

2017-08-21 Thread Jeffrey Kegler
Good point, Ron. When I started Marpa, it looked like Perl was in trouble. (Not all of the troubles that people foresaw came to pass, but many did.) I had used and liked Python. Perl was not accepted as a language in which new algorithms are written and that attitude still holds. Write a

Re: Trouble with retrieving valuation steps.

2017-08-18 Thread Jeffrey Kegler
marpa_v_step() returns -2 on failure: http://jeffreykegler.github.io/Marpa-web-site/libmarpa_api/latest/Stepping-through-the-valuator.html An error code is set, which can be retrieved with these methods:

Re: Trouble with retrieving valuation steps.

2017-08-17 Thread Jeffrey Kegler
alternation of byte sequences, in C and Tcl > > https://core.tcl.tk/akupries/marpa/artifact/51c800180911b96c > https://core.tcl.tk/akupries/marpa/artifact/da0c004acee1e326?ln=145 ff > > > On Thu, Aug 17, 2017 at 3:23 PM, Jeffrey Kegler < > > jeffreykeg...@jeffr

Re: Trouble with retrieving valuation steps.

2017-08-17 Thread Jeffrey Kegler
Looked some more at `rule` and `rslot` and I not 100% sure it's wrong, but I can't convince myself it's right. On Thu, Aug 17, 2017 at 3:23 PM, Jeffrey Kegler < jeffreykeg...@jeffreykegler.com> wrote: > Sorry to take so long. > > Ambitious stuff! > > Nothing obvious. If

Re: Trouble with retrieving valuation steps.

2017-08-17 Thread Jeffrey Kegler
Sorry to take so long. Ambitious stuff! Nothing obvious. If it were my code, I'd first double-check the `rule` and `rslot` logic, though nothing about it is obviously wrong. On Wed, Aug 16, 2017 at 9:45 PM, Andreas Kupries wrote: > > Inching along in my work on >

Re: Tomita's observation on pointers in Earley's algorithm

2017-05-25 Thread Jeffrey Kegler
Marpa uses its own pointer scheme, which is not derived from Jay Earley's, and does not have the bug Tomita reports. (At this point Marpa has been very widely used, and if its method of constructing parse trees had that or any similar bugs, I'd expect we'd have seen it a while ago.) I did look

Re: Updated theory paper?

2017-05-24 Thread Jeffrey Kegler
ot using LR(0) states from AH. > > > On Wednesday, May 24, 2017 at 4:38:37 AM UTC-5, Jeffrey Kegler wrote: >> >> Could you send me a link to the "comments in the web and text files" that >> you're referring to? I'm pretty sure I've described every change rel

Re: Updated theory paper?

2017-05-24 Thread Jeffrey Kegler
; On Tuesday, May 23, 2017 at 10:40:31 PM UTC-5, Jeffrey Kegler wrote: >> >> There's no updated theory paper. Sorry. >> >> On Tue, May 23, 2017 at 8:32 PM, <axh...@ualr.edu> wrote: >> >>> I intend to write a Rust implementation of Marpa. I've see

Re: Updated theory paper?

2017-05-23 Thread Jeffrey Kegler
There's no updated theory paper. Sorry. On Tue, May 23, 2017 at 8:32 PM, wrote: > I intend to write a Rust implementation of Marpa. I've seen a few > references to an updated algorithm, as in > > >> I've recently generalized my method and should write it up. ~Jeffrey >>

Re: Questions about slif grammar edge cases.

2017-03-30 Thread Jeffrey Kegler
(a) X ::= CC ~ 'cc' BB ~ 'bb' A A ~ 'a':discard ~ A Forbidden. is required to be a lexeme since it is a discard symbol, and cannot appear on the RHS of an L0 rule. (b) X ::= C C ~ 'cc' B ~ 'bb' A A ~ 'a' :discard ~ A is *not* unreachable. It is an L0 lexeme,

Re: Questions about slif grammar edge cases.

2017-03-29 Thread Jeffrey Kegler
The way Marpa checks internally is this 1.) Look for G1 symbols on a RHS, but not on a LHS -- these are the G1 lexemes. 2.) Look for L0 symbols on a LHS, but not on a RHS -- these are the L0 lexemes. 3.) The two sets of lexemes (G1 and L0) *should* be the same. If not, an error is reported.

Re: Questions about slif grammar edge cases.

2017-03-29 Thread Jeffrey Kegler
(4)X ::= B B ~ 'bb' A A ~ 'a' :discard ~ A "A is both used as discard, and on the RHS of the lexeme B Is that allowed ?" No, it is not. "What if B is not a lexeme?" I'd want to see an example of what you have in mind before answering this. (5)X ::= B B ~ A A ~ 'a' :discard ~

Re: Questions about slif grammar edge cases.

2017-03-29 Thread Jeffrey Kegler
OK! Quiz time! The following are off the top of my head, and untested: 1.) :start ::= A A ~ 'a' A is a lexeme and, yes, a lexeme should be OK as the start symbol. 2.) A ::= B C B ~ 'b' C ~ 'aa' B A lexeme is *NOT* OK on the RHS of an L0 rule, so B is *NOT* a lexeme. Since the grammar is

Re: decorate AST with input line numbers?

2017-03-26 Thread Jeffrey Kegler
I'm actually rusty at this, but I think the most direct way is to use the "start" and "length" item descriptors in an array descriptor to get input stream start location and length in characters: http://search.cpan.org/~jkegl/Marpa-R2/pod/Semantics.pod#Array_descriptor_actions To convert input

Marpa::R2 support of 5.10.0

2017-03-14 Thread Jeffrey Kegler
I just announced a new release of Marpa::R2 4.00. It looks 100% OK except for one issue. It accidentally regressed on support of Perl 5.10.0. Perl 5.10.0 was buggy, and was rapidly replaced by 5.10.1. It's hard to create a new installation of 5.10.0 -- perlbrew doesn't offer it, for

New release of Marpa R2 -- 4.000000

2017-03-14 Thread Jeffrey Kegler
I've uploaded a new indexed release of Marpa::R2 -- 4.00 . All tests look A-OK, with the exception of Perl 5.10.0. The value added is two bug fixes: 1.) Unicode in SLIF DSL scripts now works correctly. 2.) In the cases of most interest

Re: Understanding actions, default and custom, where to start from?

2017-03-14 Thread Jeffrey Kegler
"Bless" versus actions is just a TIMTOWTDI feature. I found bless less useful, to the extent I considered removing it in the forthcoming R3 Marpa. But it has its fans. If how bless works doesn't leap out at you, stick with actions -- they're all I use. You can learn how to use bless later --

Re: Questions about error handling in Earley parsers

2017-03-10 Thread Jeffrey Kegler
Thanks for your interest. One approach might be to do a raw, non-probabilistic parse in Marpa, and then use its Abstract Syntax Forests to do the probabilistic analysis. I'm about to run errands, but I've printed your email out to

A second Marpa::R2 release candidate

2017-03-06 Thread Jeffrey Kegler
I've uploaded 3.001_002 , a second release candidate for Marpa::R2 4.00. The first release candidate sometimes had a problem with autoconf timestamps, which causes builds of Marpa::R2 to fail on systems which did not

Re: Important: new developer's release of Marpa::R2

2017-03-01 Thread Jeffrey Kegler
@ronsavage: Thanks!! On Wed, Mar 1, 2017 at 2:37 PM, Ron Savage wrote: > Re Marpa-R2-3.001_001. Your internal tests all pass for me, and my modules > pass all their 1056 tests :-). > > -- > You received this message because you are subscribed to the Google Groups > "marpa

Re: Switching between grammars in one parse

2017-02-21 Thread Jeffrey Kegler
Try combining the 2 grammars. Marpa only recognizes *acceptable* lexemes, so if it is unambiguous which you're looking for, it will only recognizer the "right" set of lexemes. It's not like standard lexers, where the lexer is looking for everything all the time, and clueless about context. Can

Re: Finding a parse inside a (potentially long) string?

2016-12-21 Thread Jeffrey Kegler
There is also this: http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2012/11/pattern_search.html It has several problems -- it uses external lexiing, won't set speed records, and is written in an older version of Marpa::R2​, so that it may need to be translated to run. In

Re: How is precedence handling implemented?

2016-12-20 Thread Jeffrey Kegler
The top-level Marpa page shows precedence written w/o using Marpa's explicity precedenced statements: http://search.cpan.org/~jkegl/Marpa-R2-3.00/pod/Marpa_R2.pod To report errors, you have to track where the rewritten statements came from, and report the error in terms of alternatives in the

Re: Finding a parse inside a (potentially long) string?

2016-12-20 Thread Jeffrey Kegler
Looks like I decided to use a pasting service for my examples. Bad decision. Either it no longer exists or they expired them. I don't know of a way to recover them. Sorry, jeffrey On Mon, Dec 19, 2016 at 9:55 PM, wrote: > This is quite old topic, but in my opinion the

Re: To mark the occasion, a short composition

2016-10-24 Thread Jeffrey Kegler
I dunno, Ron, I klnda liked it. And if song lyrics can win the Nobel for Literature, why not DSL's? On Mon, Oct 24, 2016 at 2:48 PM, Ron Savage wrote: > Poetry it might be, but beautiful it ain't! > > -- > You received this message because you are subscribed to the Google

Re: Java 8 Parser

2016-10-15 Thread Jeffrey Kegler
e.g., be making heavy use of Perl Regex's. > > However, how would I pass the string value returned by my yylex() to Marpa > parser? > > Could someone please share a simple, "hello world" type of example, or if > not that, at least some pseudocode? > > > On Th

Re: Java 8 Parser

2016-10-15 Thread Jeffrey Kegler
tion will, > e.g., be making heavy use of Perl Regex's. > > However, how would I pass the string value returned by my yylex() to Marpa > parser? > > Could someone please share a simple, "hello world" type of example, or if > not that, at least some pseudocode? > >

Re: Java 8 Parser

2016-10-13 Thread Jeffrey Kegler
to external processing for others. Quick answers, but I hope they help, jeffrey On Thu, Oct 13, 2016 at 9:24 AM, Jeffrey Kegler < jeffreykeg...@jeffreykegler.com> wrote: > Javascript is not Java I know, but Jean-Damien Durand has written several > full language parsers, including ECMAScript: ht

Re: Java 8 Parser

2016-10-13 Thread Jeffrey Kegler
Javascript is not Java I know, but Jean-Damien Durand has written several full language parsers, including ECMAScript: https://github.com/jddurand/MarpaX-Languages-ECMAScript-AST On Thu, Oct 13, 2016 at 8:00 AM, Harry wrote: > Hello, > > I'm very new to Marpa but, from

Re: Help with libmarpa ranking and ambiguity

2016-09-02 Thread Jeffrey Kegler
ed to be precedenced > only in recursive contexts? > > On Friday, 2 September 2016, Jeffrey Kegler <jeffreykegler@jeffreykegler.c > om> wrote: > >> If you *want* ambiguity, consider avoiding the precedenced rule syntax >> and writing it directly in BNF. Precedenced rul

Re: Help with libmarpa ranking and ambiguity

2016-09-02 Thread Jeffrey Kegler
f the term. On Fri, Sep 2, 2016 at 1:37 PM, Anton Dyudin <antechno...@gmail.com> wrote: > Isn't the whole point of a precedence rule to provide a disambiguition? > > > On Friday, 2 September 2016, Jeffrey Kegler <jeffreykegler@jeffreykegler. > com> wrote: > >> If y

Re: Help with libmarpa ranking and ambiguity

2016-09-02 Thread Jeffrey Kegler
e_ref}; > print "Output:\n".Dumper($value); > > > On Wednesday, August 31, 2016 at 8:55:21 PM UTC-6, Jeffrey Kegler wrote: >> >> I've remembered a major reason for preferring the rewrite approach. If >> you parse then rank, you're using ambiguous parsi

Re: Help with libmarpa ranking and ambiguity

2016-08-31 Thread Jeffrey Kegler
meone who isn't fluent in Perl, and doesn't see a "||" > anywhere on that page, would you be willing to give some broad strokes of > what the code is doing? :3 > > > On Wednesday, 31 August 2016, Jeffrey Kegler <jeffreykegler@jeffreykegler. > com> wrote: > >&

Re: Help with libmarpa ranking and ambiguity

2016-08-31 Thread Jeffrey Kegler
ferences on how to implement this > grammar rewriting? > > Thanks! > > - Ryan > > On Wednesday, August 31, 2016 at 8:55:21 PM UTC-6, Jeffrey Kegler wrote: >> >> I've remembered a major reason for preferring the rewrite approach. If >> you parse then

Re: Help with libmarpa ranking and ambiguity

2016-08-31 Thread Jeffrey Kegler
I've remembered a major reason for preferring the rewrite approach. If you parse then rank, you're using ambiguous parsing -- Marpa is cool with that, but it is not necessarily as fast as an unambiguous parse. If the expression is of size X the parse could be as bad as O(X^3) and that can make a

Re: Testing a grammar

2016-08-26 Thread Jeffrey Kegler
Some points I hope will be useful: First, the "equivalence" of the Stack Exchange article you cite is "equivalence of languages". In most cases you aren't simply recognizing a language (a set of strings), but parsing it according to a grammar. Two language-equivalent CFG's do not necessarily

Re: Testing a grammar

2016-08-09 Thread Jeffrey Kegler
Re changing the starting rule -- you can write the SLIF DSL at runtime, adding different ":start" statements. http://search.cpan.org/~jkegl/Marpa-R2-3.00/pod/Scanless/DSL.pod#Inaccessible_symbol_statement will be useful to quiet various errors and warnings. Marpa::R2 has a test suite in the

Re: Benchmark of a simple arithmetic parser (vs Perl 5 regex)

2016-06-19 Thread Jeffrey Kegler
I only read the code hastily, too hastily to tell if results were evaluated and cross-checked, or not. On Sun, Jun 19, 2016 at 1:31 AM, <perlan...@gmail.com> wrote: > On Saturday, June 18, 2016 at 11:22:19 PM UTC+7, Jeffrey Kegler wrote: >> >> An interesting question

Re: Benchmark of a simple arithmetic parser (vs Perl 5 regex)

2016-06-18 Thread Jeffrey Kegler
sion. > > [1] > https://metacpan.org/pod/release/PERLANCAR/Bencher-Scenarios-PERLANCARParseArithmetic-0.004/lib/Bencher/Scenario/PERLANCARParseArithmetic/parse_arithmetic.pm > > On Saturday, June 18, 2016 at 10:49:16 AM UTC+7, Jeffrey Kegler wrote: >> >> Quick answers fo

Re: Benchmark of a simple arithmetic parser (vs Perl 5 regex)

2016-06-18 Thread Jeffrey Kegler
s > and up to a thousand, the Marpa version seems to be close to 3x slower than > the regex version. > > [1] > https://metacpan.org/pod/release/PERLANCAR/Bencher-Scenarios-PERLANCARParseArithmetic-0.004/lib/Bencher/Scenario/PERLANCARParseArithmetic/parse_arithmetic.pm > >

  1   2   3   4   >