Re: "rule" declarator: Different results for 'unadorned' match vs unnamed/named captures? (in re Grammars...).

2021-03-12 Thread Ralph Mellor
On Thu, Mar 11, 2021 at 8:53 PM William Michels wrote: > > I think there's something going on with the examples below, as I'm > seeing different results when comparing a basic "rule" match vs either > unnamed or named "rule" captures. All your examples are correct according to my current understa

"rule" declarator: Different results for 'unadorned' match vs unnamed/named captures? (in re Grammars...).

2021-03-11 Thread William Michels via perl6-users
Hello, I've been chatting with raiph on SO regarding Grammar "tokens" vs "rules". The OP is here https://stackoverflow.com/q/62051742 and our discussion is here https://stackoverflow.com/a/62053666 . I think there's something going on with the examples below, as I'm seeing different results when

Re: keywords in grammars

2019-12-26 Thread Brian Duggan
On Wednesday, December 25, Alt Mcarter wrote: > But I'm wondering, is there a way to write token var in such a way that it > matches <[a..z]>+ EXCEPT when it is a keyword (print, for, to, next, etc.)? You could use a negative code assertion -- #!/usr/bin/env raku my @keywords = ; grammar

keywords in grammars

2019-12-25 Thread Alt Mcarter
I'm trying to write a toy BASIC to assembler. Here's my code so far: grammar G {     rule TOP    { }     rule stmts  { * }     rule statement  { | | }     rule print-stmt { 'print' }     rule for-loop   { 'for' '=' 'to'   'next' }     rule assign { '

Parsing with Regexes and Grammars

2018-08-01 Thread Theo van den Heuvel
@Moritz Dear Moritz, I am using your book and have some remarks on it that I hope you find useful. It appears the address you are using here is send-only. The content of the book is good, but there are some problems with the publishing process. E.g. the first couple of pages are missing com

[perl #126142] [NYI] Syntactic Categories in Grammars

2017-12-01 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
Still NYI (2017.11, HEAD(5929887)), but I wonder if we really need it. On 2015-09-23 08:37:57, coke wrote: > See S05-syntactic-categories/new-symbols.t >

Re: grammars and indentation of input

2016-09-13 Thread Theo van den Heuvel
As so often it turned out that the reason my program did not work was elsewhere (in the grammar). My approach worked al along. It was instructive to look at the examples you guys mentioned. Thanks Theo

Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Bennett Todd
Well put. The clearest description of Python's approach I've read, explained it as a lexer that tracked indentation level, and inserted appropriate tokens when it changed.

Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Aaron Sherman
Oh, a side point: there's some confusion introduced by the lack of a scanner/lexer in modern all-in-one-parsers. Python, for example, uses a scanner and so its grammar is nominally not context sensitive, but its scanner very much is (maintaining a stack of indentation exactly as OP was asking abou

Re: grammars and indentation of input

2016-09-13 Thread Moritz Lenz
Hi, On 13.09.2016 18:55, Patrick R. Michaud wrote: > I don't have an example handy, but I can categorically say that > Perl 6 grammars are designed to support exactly this form of parsing. > It's almost exactly what I did in "pynie" -- a Python implementation > on

Re: grammars and indentation of input

2016-09-13 Thread Patrick R. Michaud
I don't have an example handy, but I can categorically say that Perl 6 grammars are designed to support exactly this form of parsing. It's almost exactly what I did in "pynie" -- a Python implementation on top of Perl 6. The parsing was done using a Perl 6 grammar. If I remem

Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Bennett Todd
Hostile or not, thanks for your informative reply.

Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Bennett Todd
Thank you, very much. Yes, I'm disappointed, but I'd rather know.

Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Aaron Sherman
> > Having the minutia of the programmatic run-time state of the parse then > influence the parse itself, is at the heart of the perl5 phenomenon "only > Perl can parse perl" I don't mean to be hostile, but you're demonstrably wrong, here. (also it's "only perl can parse Perl" as in, only the "pe

Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Patrick R. Michaud
On Tue, Sep 13, 2016 at 10:35:01AM -0400, Bennett Todd wrote: > Having the minutia of the programmatic run-time state of the parse then > influence the parse itself, is at the heart of the perl5 phenomenon "only > Perl can parse perl", which I rather hope isn't going to be preserved in > perl6.

Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Theo van den Heuvel
Hi Bennett, There are many situations that require non-contextfree languages. Even though much of these could be solved in the AST-building step (called 'transduction' in my days) instead of the parsing step, that does not solve all cases. I am just wondering if and to what extent we can parse

Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Bennett Todd
Having the minutia of the programmatic run-time state of the parse then influence the parse itself, is at the heart of the perl5 phenomenon "only Perl can parse perl", which I rather hope isn't going to be preserved in perl6.

Fwd: Re: grammars and indentation of input

2016-09-13 Thread Theo van den Heuvel
Thanks Timo and Brian, both examples are educational. However, they have a common limitation in that they both perform their magic after a Match object has been created. I was trying to influence the parsing step itself. I am experimenting to find if I can influence the parsing process progr

Re: grammars and indentation of input

2016-09-13 Thread Aaron Sherman
, Sep 13, 2016 at 7:13 AM, Theo van den Heuvel wrote: > Hi all, > > I am beginning to appreciate the power of grammars and the Match class. > This is truly a major asset within Perl6. > > I have a question on an edge case. I was hoping to use a grammar for an > input that has

Re: grammars and indentation of input

2016-09-13 Thread Brian Duggan
I've also recently been experimenting with parsing an indent-based language -- specifically, a small subset of Slim () -- I push to a stack when I see a tag, and pop based on the depth of the indendation. Here's a working example: https://git.io/vig93 Brian

Re: grammars and indentation of input

2016-09-13 Thread Timo Paulssen
I haven't read your code, but your question immediately made me think of this module: https://github.com/masak/text-indented Would be interested to hear if this helps you! - Timo

grammars and indentation of input

2016-09-13 Thread Theo van den Heuvel
Hi all, I am beginning to appreciate the power of grammars and the Match class. This is truly a major asset within Perl6. I have a question on an edge case. I was hoping to use a grammar for an input that has meaningful indented blocks. I was trying something like this: token element

[perl #126142] [NYI] Syntactic Categories in Grammars

2015-09-23 Thread via RT
# New Ticket Created by Will Coleda # Please include the string: [perl #126142] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=126142 > See S05-syntactic-categories/new-symbols.t -- Will "Coke" Coleda

[perl #125169] [BUG] our scoped tokens in grammars do not accept Cursor

2015-05-13 Thread via RT
# New Ticket Created by Tobias Leich # Please include the string: [perl #125169] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=125169 > grammar D { our token doo { doo }; }; say 'doo' ~~ &D::doo rakudo-moar a6f563: OUTPUT«Ty

Re: generating grammars, capturing in regex interpolation, etc.

2015-04-20 Thread Nathan Gray
> Am 17.04.2015 um 04:34 schrieb Nathan Gray: > > # Call it if it is a routine. This will capture if requested. > > return (var)(self) if nqp::istype(var,Callable); > > > > This seems to indicate that captures in the embedded regexes > > should capture. On Fri, Apr 17, 2015 at 09:47:22AM +0200

Re: Grammars

2015-04-20 Thread Larry Wall
On Sun, Apr 19, 2015 at 06:31:30PM +0200, mt1957 wrote: : L.s., : : I found a small problem when writing a piece of grammar. A : simplified part of it is shown here; : ... : token tag-body { ~ } : token body-start { '[' } : token body-end { ']' } : token body-text { .*? } : ... : A coupl

Grammars

2015-04-19 Thread mt1957
L.s., I found a small problem when writing a piece of grammar. A simplified part of it is shown here; ... token tag-body { ~ } token body-start { '[' } token body-end { ']' } token body-text { .*? } ... I needed to do something on body-end so I wrote a method for it using an actions c

Re: generating grammars, capturing in regex interpolation, etc.

2015-04-17 Thread Tobias Leich
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The comment in INTERPOLATE is about "subcaptures"... but if you do not capture the interpolated regex itself, you break that chain. Am 17.04.2015 um 04:34 schrieb Nathan Gray: > On Wed, Apr 15, 2015 at 09:45:39PM -0400, Nathan Gray wrote: >> I had g

Re: generating grammars, capturing in regex interpolation, etc.

2015-04-16 Thread Nathan Gray
On Wed, Apr 15, 2015 at 09:45:39PM -0400, Nathan Gray wrote: > I had given up on using regexes embedded within regexes, because > I could not get capturing to work. I did a backtrace on one of the test cases that fails, which led me to src/core/Cursor.pm in method INTERPOLATE(\var, $i = 0,

Re: generating grammars, capturing in regex interpolation, etc.

2015-04-15 Thread Nathan Gray
On Tue, Apr 14, 2015 at 08:58:29PM -0500, Patrick R. Michaud wrote: > Just an idea: instead of building strings to be interpolated into > a regex, could you just build regexes directly? > > my $pattern = rx/$=[hello]/; > my $match = "hello" ~~ / /; > > The resulting string is captured i

Re: generating grammars, capturing in regex interpolation, etc.

2015-04-14 Thread Patrick R. Michaud
On Tue, Apr 14, 2015 at 08:58:27PM -0400, Nathan Gray wrote: > I've run into a snag, in that my strptime processing in Perl 5 > relies on building a string that looks like a regex with named > captures, and then interpolating that into a real regex. >[...] > my $pattern = Q/$=[hello]/; > my

generating grammars, capturing in regex interpolation, etc.

2015-04-14 Thread Nathan Gray
I've been playing in Perl 6 (after several years of absence). I am very impressed. I'm porting my recent Date::Reformat into Perl 6, for fun, to get me back into the Perl 6 headspace, and possibly to help others, either with something useful, or something they can look to for examples. I've run

Re: Grammars and biological data formats

2014-08-16 Thread Fields, Christopher J
something that reads chunks and then parses that. It'll be a >>> bit more code, but it'll work today. But I see you reached that >>> conclusion already. :) >>> >>> Lately I've found myself writing more and more grammars that parse >>> just

Re: Grammars and biological data formats

2014-08-16 Thread Martin D Kealey
s that. It'll be a > > bit more code, but it'll work today. But I see you reached that > > conclusion already. :) > > > > Lately I've found myself writing more and more grammars that parse > > just one line of some input. Provided that the same action object get

Re: Grammars and biological data formats

2014-08-14 Thread Fields, Christopher J
Mäsak" wrote: > > I was going to pipe in and say that I wouldn't wait around for Cat, > I'd write something that reads chunks and then parses that. It'll be a > bit more code, but it'll work today. But I see you reached that > conclusion already. :) > > L

Re: Grammars and biological data formats

2014-08-14 Thread Carl Mäsak
I was going to pipe in and say that I wouldn't wait around for Cat, I'd write something that reads chunks and then parses that. It'll be a bit more code, but it'll work today. But I see you reached that conclusion already. :) Lately I've found myself writing more and more

Re: Grammars and biological data formats

2014-08-13 Thread Fields, Christopher J
On Aug 13, 2014, at 8:11 AM, Christopher Fields wrote: > On Aug 13, 2014, at 4:50 AM, Solomon Foster wrote: > >> On Sat, Aug 9, 2014 at 7:26 PM, Fields, Christopher J >> wrote: >>> I have a fairly simple question regarding the feasibility of using grammars >&g

Re: Grammars and biological data formats

2014-08-13 Thread Fields, Christopher J
On Aug 13, 2014, at 4:50 AM, Solomon Foster wrote: > On Sat, Aug 9, 2014 at 7:26 PM, Fields, Christopher J > wrote: >> I have a fairly simple question regarding the feasibility of using grammars >> with commonly used biological data formats. >> >> My main quest

Re: Grammars and biological data formats

2014-08-13 Thread Solomon Foster
On Sat, Aug 9, 2014 at 7:26 PM, Fields, Christopher J wrote: > I have a fairly simple question regarding the feasibility of using grammars > with commonly used biological data formats. > > My main question: if I wanted to parse() or subparse() vary large files (not > unheard o

Grammars and biological data formats

2014-08-13 Thread Fields, Christopher J
I have a fairly simple question regarding the feasibility of using grammars with commonly used biological data formats. My main question: if I wanted to parse() or subparse() vary large files (not unheard of to have FASTA/FASTQ or other similar data files exceed 100’s of GB) would a grammar

Re: Grammars and biological data formats

2014-08-09 Thread Fields, Christopher J
On Aug 9, 2014, at 8:51 PM, "Fields, Christopher J" wrote: > > >> On Aug 9, 2014, at 5:25 PM, "t...@wakelift.de" wrote: >> >> >>> On 08/10/2014 12:21 AM, t...@wakelift.de wrote: >>> Something that does surprise me is that your tests seem to imply that :p >>> for subparse doesn't work. I'll l

Re: Grammars and biological data formats

2014-08-09 Thread Fields, Christopher J
> On Aug 9, 2014, at 5:25 PM, "t...@wakelift.de" wrote: > > >> On 08/10/2014 12:21 AM, t...@wakelift.de wrote: >> Something that does surprise me is that your tests seem to imply that :p >> for subparse doesn't work. I'll look into that, because I believe it >> ought to be implemented already.

Re: Grammars and biological data formats

2014-08-09 Thread Darren Duncan
I've already been thinking for awhile now that parsers need to be able to operate in a streaming fashion (when the grammars lend themselves to it, by not needing to lookahead, much if at all, to understand what they've already seen) so that strings that don't fit in memory all

Re: Grammars and biological data formats

2014-08-09 Thread timo
On 08/10/2014 12:21 AM, t...@wakelift.de wrote: > Something that does surprise me is that your tests seem to imply that :p > for subparse doesn't work. I'll look into that, because I believe it > ought to be implemented already. Perhaps not properly hooked up, though. On #perl6 I got corrected qu

Re: Grammars and biological data formats

2014-08-09 Thread timo
(accidentally sent this privately only, now re-sending to the list) Hello Christopher, In the Perl 6 specification, there are plans for lazy and memory-releasing ways to parse strings that are either too large to fit into memory at once or that are generated lazily (like being streamed in through

Grammars and biological data formats

2014-08-09 Thread Fields, Christopher J
(accidentally sent to perl6-lang, apologies for cross-posting but this seems more appropriate) I have a fairly simple question regarding the feasibility of using grammars with commonly used biological data formats. My main question: if I wanted to parse() or subparse() vary large files (not

Re: [perl #114748] recursive grammars

2012-09-05 Thread Wenzel Peppmeyer
y are defined. Some macros are defined in another file. Since it's just a non-cyclic include I might as well just think recursively -- .parse does not agree. It's not so much that I could not get around the overwritten $/ but that it happens silently and debugging grammars is not the

[perl #114748] recursive grammars

2012-09-04 Thread via RT
# New Ticket Created by Wenzel Peppmeyer # Please include the string: [perl #114748] # in the subject line of all future correspondence about this issue. # https://rt.perl.org:443/rt3/Ticket/Display.html?id=114748 > # gammars seam to get confused when used recursively use v6; my $s1 = 'AA fo

Re: Perl6 grammars -- Parsing english

2012-07-11 Thread Moritz Lenz
Hi Lard, sorry for the late and incomplete answer. Am 04.07.2012 15:09, schrieb Lard Farnwell: Hi Moritz, Thanks that was interesting. My investigation into grammars took a while but here are the results thus far: Grammar rules and regexes are just methods… I hadn't thought about w

Re: Perl6 grammars -- Parsing english

2012-07-04 Thread Lard Farnwell
Hi Moritz, Thanks that was interesting. My investigation into grammars took a while but here are the results thus far: > Grammar rules and regexes are just methods… I hadn't thought about what a grammar and rule actually was before. This inspired m

Re: Perl6 grammars -- Parsing english

2012-06-26 Thread Moritz Lenz
On 06/26/2012 02:04 PM, Lard Farnwell wrote: > Hi guys, > > To understand and play around with perl6 grammars I was trying to do a simple > NLP parts of speech parser in perl6 grammars. This is sort of what I did: > > --- > grammar Sentence{ &g

Perl6 grammars -- Parsing english

2012-06-26 Thread Lard Farnwell
Hi guys, To understand and play around with perl6 grammars I was trying to do a simple NLP parts of speech parser in perl6 grammars. This is sort of what I did: --- grammar Sentence{ proto rule VP {*} proto rule NP {*} rule sentence

[perl #113808] Bug report: whitespace in grammars

2012-06-26 Thread via RT
all. -Sir 20:07 < sirrobert> I'm learning to write grammars, but having a wierd problem. (I think there's something I don't get about newlines or something). 20:07 < sirrobert> https://gist.github.com/2980628 20:08 < pmichaud> \s* doesn't really make sense

Grammars: parse tags of which only some need closing tags

2010-08-28 Thread Moritz Lenz
. Some of them stand on their own, like [% setvar title Grammars: parse tags of which only some ... %] And others have opening/closing pairs, and their proper nesting needs to be enforced, for example [% ifvar title %] [% readvar title %] [% endifvar %] (yes, the syntax is horrible, but when

[perl #75914] incomplete support of names with dash in grammars

2010-06-22 Thread via RT
# New Ticket Created by Stephane Payrard # Please include the string: [perl #75914] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=75914 > $ perl6 > grammar { token a-a { a } } () > grammar { token a-a { a }; token b { }

Re: Reversible grammars

2010-06-04 Thread Timothy S. Nelson
On Fri, 4 Jun 2010, Stefan O'Rear wrote: On Sat, Jun 05, 2010 at 09:19:01AM +1000, Timothy S. Nelson wrote: Hi. I've been thinking more about reversible grammars. Specifically, I'm wondering if the following pseudo-code will be possible: ## Match a gram

Re: Reversible grammars

2010-06-04 Thread Stefan O'Rear
On Sat, Jun 05, 2010 at 09:19:01AM +1000, Timothy S. Nelson wrote: > Hi. I've been thinking more about reversible grammars. Specifically, > I'm wondering if the following pseudo-code will be possible: > > ## Match a grammar here > $match = Grammar.match($text) &g

Reversible grammars

2010-06-04 Thread Timothy S. Nelson
Hi. I've been thinking more about reversible grammars. Specifically, I'm wondering if the following pseudo-code will be possible: ## Match a grammar here $match = Grammar.match($text) ## Need some code here to get $submatch from $match $submatch.Str = "fred" ## R

Re: [perl #73244] [PATCH] implement grammars

2010-03-07 Thread Moritz Lenz
Hi Bruce, Bruce Keeler (via RT) wrote: > The attached patch is also available in the 'grammar' branch of my > github fork (bkeeler/rakudo). I'll keep that branch up to date to make > sure it applies cleanly. Thank you very much for your great work; I've merged it from the github branch (as com

[perl #73244] [PATCH] implement grammars

2010-03-03 Thread via RT
to factor out common code between regex_def and method_def, but ran into problems and backed out. I'll take another crack at this sometime soon. From 1d3b996dee09880c20dbe40dab96158ba1dfe220 Mon Sep 17 00:00:00 2001 From: Bruce Keeler Date: Sun, 28 Feb 2010 20:36:20 -0800 Subject: [PATC

Re: Debugging Grammars

2009-12-29 Thread Carl Mäsak
t;> Aside from the advent calendar or the online docs at >> http://perlcabal.org/syn/S05.html, are there any other resources for >> explaining the generation of an AST from a grammar? > > Yes: #perl6 -- or more specifically, moritz++ and a number of other > people who

Re: Debugging Grammars

2009-12-29 Thread Carl Mäsak
e online docs at > http://perlcabal.org/syn/S05.html, are there any other resources for > explaining the generation of an AST from a grammar? Yes: #perl6 -- or more specifically, moritz++ and a number of other people who have built dozens of grammars already. // Carl

Re: Debugging Grammars

2009-12-29 Thread Ovid
Wiki - http://www.perlfoundation.org/perl6 - Original Message > From: Patrick R. Michaud > To: Ovid > Cc: perl6-langu...@perl..org > Sent: Sun, 27 December, 2009 16:57:44 > Subject: Re: Debugging Grammars > > On Sun, Dec 27, 2009 at 01:30:18AM -0800, Ovid wrote: &g

Re: Debugging Grammars

2009-12-27 Thread Ovid
- Original Message > From: Patrick R. Michaud > Any \s* will end up matching the final \n, and since quantifiers > in tokens default to "non backtracking", \s* \n in a token will > always fail. (In P5, it'd be like "(?>\s*)\n".) Perhaps > \h* \n would do what you want here? Works l

Re: Debugging Grammars

2009-12-27 Thread Patrick R. Michaud
On Sun, Dec 27, 2009 at 01:30:18AM -0800, Ovid wrote: > > my $config = Config::Tiny::Grammar.parse($text); > #say $config ?? 'yes' || 'no'; > say $config.perl; > > Currently this matches, but if I add a \s* before the final \n > in the section token, it fails to match. I don't know

Debugging Grammars

2009-12-27 Thread Ovid
To understand grammars better, I figured I would convert Config::Tiny to Perl 6. I've started with the following: grammar Config::Tiny::Grammar { token TOP { ? + } token root_section { + } token se

Re: [perl #66250] Trouble with white space in Rakudo grammars

2009-06-05 Thread Jonathan Scott Duff
On Wed, Jun 3, 2009 at 8:08 AM, Håkon Skaarud Karlsen < perl6-bugs-follo...@perl.org> wrote: > # New Ticket Created by Håkon Skaarud Karlsen > # Please include the string: [perl #66250] > # in the subject line of all future correspondence about this issue. > # http://rt.perl.org/rt3/Ticket/Displ

[perl #66250] Trouble with white space in Rakudo grammars

2009-06-04 Thread Patrick R. Michaud via RT
On Wed Jun 03 06:08:46 2009, haakonsk wrote: > This doesn't work: > grammar A { rule TOP { 'a' ' b' {*} } }; my $m = A.parse('a b'); say $/; > Result: Empty string > Expected result: "a b" Rakudo is correct here. Whitespace in rules is metasyntactic -- it gets replaced by <.ws>. So, the above r

[perl #66250] Trouble with white space in Rakudo grammars

2009-06-04 Thread via RT
# New Ticket Created by Håkon Skaarud Karlsen # Please include the string: [perl #66250] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=66250 > This works: grammar A { rule TOP { 'a ' 'b' {*} } }; my $m = A.parse('a b');

Re: Grammars that generate stuff

2009-03-28 Thread Matthew Wilson
On Sat, Mar 28, 2009 at 1:48 AM, Timothy S. Nelson wrote: >Perl 6 has a general language (grammars) for taking some input and a > grammar, and separating the data from the formatting, as it were. > >Ideally, it'd be possible to specify one grammar that would act b

Grammars that generate stuff

2009-03-27 Thread Timothy S. Nelson
se with .perl -- it takes some data, and turns it into a string formatted in a particular way. Perl 6 has a general language (grammars) for taking some input and a grammar, and separating the data from the formatting, as it were. What's made Perl 6 so much more powerful in this area is the

Is there a reasonable way to access perl 6 regexen and grammars in haskell, via the pugs modules? (where's the make ghci target?)

2009-03-15 Thread Thomas Hartman
I started to look into this and got stuck loading pugs in ghci, about which I posted at http://www.perlmonks.org/?node_id=750768 The INSTALL file mentions a make ghci target but that appears to be gone now. Any chance of getting it back?

[perl #63462] .parse doesn't work on many-jointed grammars

2009-02-25 Thread jn...@jnthn.net via RT
On Wed Feb 25 01:06:52 2009, masak wrote: > rakudo: grammar A::B { regex TOP { foo } }; A::B.parse("") > rakudo 7f8ba6: OUTPUT«Null PMC access in get_string() [...] > Huston, we have a problem. > * masak submits rakudobug Problem resolved in git 59fcc4e and test added to S05-grammar/parse_and_p

Call-and-response grammars?

2009-02-15 Thread Timothy S. Nelson
en "MAIL FROM", "RCPT TO", "DATA", and the like, each with an appropriate response. Is there some way to write a single grammar that encapsulates the whole thing, a grammar that could be used one way by a client, and another way by a server? I guess my rea

[perl #60924] Grammars in classes causes Rakudo to crash

2009-01-22 Thread jn...@jnthn.net via RT
On Sat Nov 29 17:03:22 2008, masak wrote: > Rakudo r33329 can't instantiate classes that contain a grammar. > > $ perl6 -e 'class A { grammar B {} }; A.new' > Null PMC access in get_string() > [...] Fixed in r35884, and tests added in Pugs r25000 (plus to make sure you can invoke rules in the nes

Re: how to call Grammars correctly?

2008-12-18 Thread Andy_Bach
>> So, I try to use that way: >> >> grammar G { >> token TOP { ^ + $ }; >> token foo { ':' ? }; >> token bar { \w }; >> }; >> >> ":a:b:c" ~~ //; >> >> say $/; >> say $/; #Use of uninitialized value >> say $_ for $/; # Use of uninitialized value > > Try $/ Or even $/ (haven't tried it,

Re: how to call Grammars correctly?

2008-12-18 Thread Moritz Lenz
Vasily Chekalkin wrote: > Илья wrote: >> Hi, >> >> PM> if the rule is called correctly it appears to work fine: >> >> PM> if 'foo' ~~ // >> >> So, I try to use that way: >> >> grammar G { >> token TOP { ^ + $ }; >> token foo { ':' ? }; >> token bar { \w }; >> }; >> >> ":a:b:c" ~~ /

Re: how to call Grammars correctly?

2008-12-18 Thread Vasily Chekalkin
Илья wrote: Hi, PM> if the rule is called correctly it appears to work fine: PM> if 'foo' ~~ // So, I try to use that way: grammar G { token TOP { ^ + $ }; token foo { ':' ? }; token bar { \w }; }; ":a:b:c" ~~ //; say $/; say $/; #Use of uninitialized value say $_ for $/; # Use

[perl #60716] [PATCH] invoke multi-level namespace grammars from rules

2008-12-17 Thread jn...@jnthn.net via RT
On Sat Nov 29 08:34:39 2008, chrisdolan wrote: > Without my patch, the first of the following succeeds but the second > fails. With the patch, they both succeed. My patch allows you to use > more than one "::" in a <> element *inside* a regex. > > grammar Grammar::Deep { token foo { 'foo' }; } >

how to call Grammars correctly?

2008-12-17 Thread Илья
Hi, PM> if the rule is called correctly it appears to work fine: PM> if 'foo' ~~ // So, I try to use that way: grammar G { token TOP { ^ + $ }; token foo { ':' ? }; token bar { \w }; }; ":a:b:c" ~~ //; say $/; say $/; #Use of uninitialized value say $_ for $/; # Use of uninitializ

[perl #60924] Grammars in classes causes Rakudo to crash

2008-11-30 Thread Carl Mäsak
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #60924] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=60924 > Rakudo r33329 can't instantiate classes that contain a grammar. $ perl6 -e 'class A { g

[perl #60716] [PATCH] invoke multi-level namespace grammars from rules

2008-11-21 Thread via RT
# New Ticket Created by Chris Dolan # Please include the string: [perl #60716] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=60716 > This code works in Rakudo rev 32970: grammar GrammarOne { token foo { 'foo' }; } g

[perl #60358] Rakudo doesn't recognize grammars with :: in the name

2008-11-11 Thread [EMAIL PROTECTED] via RT
On Wed Nov 05 19:31:36 2008, chrisdolan wrote: > It took a while to understand the code, but the solution was a > one-liner. Patch attached. Unfortunately, the patch produced a bunch of spectest failures. However, it wasn't because the patch was wrong, but rather a bug in some code generation in P

[perl #60358] Rakudo doesn't recognize grammars with :: in the name

2008-11-06 Thread Carl Mäsak
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #60358] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=60358 > rakudo: grammar A { token foo { foo } }; say "foo" ~~ A::foo rakudo 32364: OUTPUT[foo␤

Re: Signatures and matching (was "Re: XPath grammars (Was: Re: globs and trees in Perl6)")

2008-10-27 Thread TSa
HaloO, David Green wrote: On 2008-Oct-22, at 10:03 am, TSa wrote: Note that types have a fundamentally different task in a signature than name and position have. The latter are for binding arguments to parameters. The types however are for selection of dispatch target. Names do that too; I t

Re: Signatures and matching (was "Re: XPath grammars (Was: Re: globs and trees in Perl6)")

2008-10-25 Thread David Green
On 2008-Oct-22, at 10:03 am, TSa wrote: David Green wrote: One thing I would like signatures to be able to do, though, is assign parameters by type. Much like a rule can look for identifiable objects like a or , it would be very useful to look for parameters by their type or class rather

Re: Signatures and matching (was "Re: XPath grammars (Was: Re: globs and trees in Perl6)")

2008-10-22 Thread Timothy S. Nelson
On Tue, 21 Oct 2008, Timothy S. Nelson wrote: On Tue, 21 Oct 2008, David Green wrote: On 2008-Oct-2, at 6:15 pm, Timothy S. Nelson wrote: The guys on IRC convinced me that the way to go might be something like a grammar, but that does trees and tree transformations instead of a text input st

Re: Signatures and matching (was "Re: XPath grammars (Was: Re: globs and trees in Perl6)")

2008-10-22 Thread TSa
HaloO, David Green wrote: One thing I would like signatures to be able to do, though, is assign parameters by type. Much like a rule can look for identifiable objects like a or , it would be very useful to look for parameters by their type or class rather than by name (or position). For ex

Re: Signatures and matching (was "Re: XPath grammars (Was: Re: globs and trees in Perl6)")

2008-10-22 Thread Timothy S. Nelson
On Wed, 22 Oct 2008, Brad Bowman wrote: The "scrap your boilerplate" scheme for generics in Haskell addresses traversals, queries, transformations, parallel zipping and the like. I've only briefly felt like I understood it, so I was going to revise before trying to adapt it to Perl 6. (Any lam

Re: Signatures and matching (was "Re: XPath grammars (Was: Re: globs and trees in Perl6)")

2008-10-22 Thread Brad Bowman
The "scrap your boilerplate" scheme for generics in Haskell addresses traversals, queries, transformations, parallel zipping and the like. I've only briefly felt like I understood it, so I was going to revise before trying to adapt it to Perl 6. (Any lambdacamels out there that do understand th

Re: Signatures and matching (was "Re: XPath grammars (Was: Re: globs and trees in Perl6)")

2008-10-21 Thread Timothy S. Nelson
On Tue, 21 Oct 2008, David Green wrote: On 2008-Oct-2, at 6:15 pm, Timothy S. Nelson wrote: The guys on IRC convinced me that the way to go might be something like a grammar, but that does trees and tree transformations instead of a text input stream. See the IRC log for details :). [...] n

Signatures and matching (was "Re: XPath grammars (Was: Re: globs and trees in Perl6)")

2008-10-21 Thread David Green
On 2008-Oct-2, at 6:15 pm, Timothy S. Nelson wrote: The guys on IRC convinced me that the way to go might be something like a grammar, but that does trees and tree transformations instead of a text input stream. See the IRC log for details :). [...] note to treematching folks: it is envisag

Re: globs and rules and trees, oh my! (was: Re: XPath grammars (Was: Re: globs and trees in Perl6))

2008-10-03 Thread Jon Lang
Timothy S. Nelson wrote: >> note to treematching folks: it is envisaged that signatures in >> a rule will match nodes in a tree >> >>My question is, how is this expected to work? Can someone give an >> example? > >I'm assuming that this relates to Jon Lang's comment about using >

globs and rules and trees, oh my! (was: Re: XPath grammars (Was: Re: globs and trees in Perl6))

2008-10-02 Thread Timothy S. Nelson
On Fri, 3 Oct 2008, Timothy S. Nelson wrote: On Fri, 3 Oct 2008, Timothy S. Nelson wrote: On Thu, 2 Oct 2008, Timothy S. Nelson wrote: Now that Perl6 is in the mix, though, I think that the best way to do it is to make roles that model eg. Nodes, Plexes (Documents), Elements, and the like,

Re: XPath grammars (Was: Re: globs and trees in Perl6)

2008-10-02 Thread Timothy S. Nelson
On Fri, 3 Oct 2008, Timothy S. Nelson wrote: On Thu, 2 Oct 2008, Timothy S. Nelson wrote: Now that Perl6 is in the mix, though, I think that the best way to do it is to make roles that model eg. Nodes, Plexes (Documents), Elements, and the like, and then have operators on them do all the wor

XPath grammars (Was: Re: globs and trees in Perl6)

2008-10-02 Thread Daniel Ruoso
Qui, 2008-10-02 às 12:55 +0100, Tim Bunce escreveu: > Like applying XPath to an XML DOM, only more general and taken > further. > By "more general and taken further" I'm thinking of the same kind of > evoltion from simple regular expressions in perl5 to grammars in perl

Re: XPath grammars (Was: Re: globs and trees in Perl6)

2008-10-02 Thread Jon Lang
For tree-oriented pattern matching syntax, I'd recommend for inspiration the RELAX NG Compact Syntax, rather than XPath. Technically, RELAX NG is an XML schema validation language; but the basic principle that it uses is to describe a tree-oriented pattern, and to consider the document to be valid

Re: XPath grammars (Was: Re: globs and trees in Perl6)

2008-10-02 Thread Brandon S. Allbery KF8NH
On Oct 2, 2008, at 10:36 , Timothy S. Nelson wrote: On Thu, 2 Oct 2008, Timothy S. Nelson wrote: Now that Perl6 is in the mix, though, I think that the best way to do it is to make roles that model eg. Nodes, Plexes (Documents), Elements, and the like, and then have operators on them do all

Re: XPath grammars (Was: Re: globs and trees in Perl6)

2008-10-02 Thread Timothy S. Nelson
On Thu, 2 Oct 2008, Timothy S. Nelson wrote: Now that Perl6 is in the mix, though, I think that the best way to do it is to make roles that model eg. Nodes, Plexes (Documents), Elements, and the like, and then have operators on them do all the work (like my idea of using a slash for a combine

Re: XPath grammars (Was: Re: globs and trees in Perl6)

2008-10-02 Thread Timothy S. Nelson
On Thu, 2 Oct 2008, Daniel Ruoso wrote: One thing we realized at that time is that XPath is good enough, even if it seems to be adressing XML specifically, it has the concept of "dimension" that can be extended to represent arbitrary aspects of objects. Hmm. Back in March, before I discovere

  1   2   >