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

2016-12-23 Thread hovercraft-google
Yes, this is exactly what I do, and it works. MO, just make sure your BNF produces a parser that parses all the inputs > correctly and then use parens to weed out the uninteresting parts as needed. > -- You received this message because you are subscribed to the Google Groups "marpa parser" gr

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

2016-12-23 Thread Ruslan Shvedov
IMO, just make sure your BNF produces a parser that parses all the inputs correctly and then use parens to weed out the uninteresting parts as needed. On Thu, Dec 22, 2016 at 5:38 PM, hovercraft-google wrote: > Thank you very much for your attention and references. Actually, I already > saw and

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

2016-12-22 Thread Ron Savage
Glad to help. But as for the uninteresting parts, my fear is that you'll need to more-or-less define them just to be able to tell Marpa what to skip. I wonder if using priorities would be best, so telling Marpa the interesting parts have high priority and the other part have low priority should

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

2016-12-22 Thread hovercraft-google
In my previous post I accidentally abused term DSL - I just meant 'parsers', sorry, -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to marpa-parser+unsubscr...@goo

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

2016-12-22 Thread hovercraft-google
Thank you very much for your attention and references. Actually, I already saw and continue to study some of it. In essence, what I am looking for is a most efficient development tool for DSLs in several application areas. Specifics is in that these kinds of DSL doesn't require strict parsing o

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

2016-12-21 Thread Ron Savage
There are many Perl packages to study at http://savage.net.au/Marpa.html#Perl_Packages. In particular, Text::Balanced::Marpa and Text::Balanced::Delimited have the concept of delimited strings, where you may define the delimiters to be anything. Also, GraphViz2::Marpa contains 2 BNFs, one for

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 Marpa::

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

2016-12-21 Thread hovercraft-google
Well, this is a fate of those examples :) I have some generic question: what is the easiest way to skip part of input stream until some keyword or lexeme appears? Is it possible to do this in Marpa without using external lexer and/or events? May be putting an undesired_part symbol inside parent

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 use case discussed the

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

2016-12-19 Thread hovercraft
This is quite old topic, but in my opinion the use case discussed there is very important. Unfortunately, links to both examples are broken now. Could somebody fix it, please? -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe fro

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

2014-06-09 Thread Ron Savage
> > expressions. That world is like bell-bottom jeans, with one difference: > bell-bottoms might come back. > They have, Jeffrey, a couple of years ago :-(. -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group an

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

2014-06-09 Thread Jeffrey Kegler
I agree with Christopher's post just about word-for-word, but with one exception, which is this: Wishing Marpa's audience is something other than it is, is pointless. Marpa has to be presented to the programming profession we have, not the one we'd like, even if the one we'd like is arguably

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

2014-06-09 Thread Christopher Layne
Personally I think people need to know when not to use a regex and when to switch to a proper grammar/parser. I've been in that boat myself and made the mistake more than a few times. When the regex itself is actually more complicated and difficult to understand vs the grammar, the value of con

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

2014-06-09 Thread Durand Jean-Damien
Definitely -; Btw there is a full regexp engine writen with Marpa (well, the JavaScript one, wich differs from perl with quite subtile things ) here

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

2014-06-09 Thread Jeffrey Kegler
By the way, another target of opportunity is a regex engine which detects "hard" and "easy" regexes. Most regexes it would handle in the ordinary way, with a regex engine, but the hard ones it hands over to Marpa. This might prove popular because people *want* to do everything with a regex.

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

2014-06-09 Thread Jeffrey Kegler
Where the search target *is* a regular expression, Marpa will never be competitive with regexes. But regexes get used for a lot of things which are NOT regular expressions, and on these Marpa can and does win. I've used matching parentheses as an example. These are not regular expressions, b

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

2014-06-09 Thread Steven Haryanto
Thanks for the answer and explanation. I see that the second approach is about 50% faster on my PC. Although speed-wise it's not on par with regex for this simple case[*], it's interesting nevertheless and will be useful in certain cases. *) Did a simple benchmark for string: ("a" x 1000) . " 1

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

2014-06-08 Thread Jeffrey Kegler
I've donea 2nd version of this , which I think should be faster and, especially, take less memory. This technique is, I hope, of wide interest. To do an "unanchored" search, it uses Marpa's :discard mechanism. Essentially, it treats strings that are not part o

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

2014-06-08 Thread Jeffrey Kegler
I've pasted an example that passes your test cases . It's just one of the several possible approaches. This one works by moving the expressions down into the lexer, and searching for them as lexemes. I've thought, and written in my blog, a lot on the topic of

Finding a parse inside a (potentially long) string?

2014-06-07 Thread Steven Haryanto
Hi all, I wonder if it's feasible to use Marpa, like regular expression, to detect some pattern inside a string. An example of what I'm trying to do is to extract some numeric expression from these strings: "1+2" "This is an expression: 1+2, and this is another 1+2+4" "1+2 is the expression" I