Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2013-08-08 Thread Tom Compton
On Sunday, 11 March 2012 at 12:40:34 UTC, Alex Rønne Petersen wrote: Question: Are the generated parsers, AST nodes, etc classes or structs? Why is this important?

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2013-08-07 Thread Elie Morisse
Hi Philippe, I wrote a Kate(the official text editor of KDE, also used in KDevelop) syntax highlighting file for Pegged: http://www.homo-nebulus.fr/dlang/pegged.xml Screenshot: http://imgur.com/sb3jFqs.png Of course for the syntax highlighting to work the grammar must be in a separate file

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-22 Thread Martin Nowak
On Sun, 11 Mar 2012 00:28:42 +0100, Philippe Sigaud philippe.sig...@gmail.com wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. https://github.com/PhilippeSigaud/Pegged docs: https://github.com/PhilippeSigaud/Pegged/wiki PEG: http

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-13 Thread Jay Norwood
On Tuesday, 13 March 2012 at 05:25:38 UTC, Jay Norwood wrote: Admittedly I have not heard of PEGs before, so I'm curious: Is this powerful enough to parse a language such as C? I've just read a few articles referenced from this page, and the second link was by someone who had done java

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-13 Thread Tobias Pankrath
I am impressed. That's a really nice showcase for the D compile time features. Can I use PEG to parse languages like python and haskell where indention matters without preprocessing? Will you make it work with input ranges of dchar? So that I can easily plug in some preprocessing steps?

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 08:51, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I was thinking of ANTLR-style operators in which you say where the root should be and you get to drop unnecessary nodes. (Post on 2012/02/29 10:19AM GMT-0600.) Get it, thanks for the ref! There is an

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Alex Rønne Petersen
On 11-03-2012 08:22, Philippe Sigaud wrote: On Sun, Mar 11, 2012 at 00:34, Alex Rønne Petersenxtzgzo...@gmail.com wrote: Admittedly I have not heard of PEGs before, so I'm curious: Is this powerful enough to parse a language such as C? I think so. But you'd have to do add some semantic

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Alex Rønne Petersen
On 11-03-2012 00:28, Philippe Sigaud wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. https://github.com/PhilippeSigaud/Pegged docs: https://github.com/PhilippeSigaud/Pegged/wiki PEG: http://en.wikipedia.org/wiki

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Alex Rønne Petersen
On 11-03-2012 00:28, Philippe Sigaud wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. https://github.com/PhilippeSigaud/Pegged docs: https://github.com/PhilippeSigaud/Pegged/wiki PEG: http://en.wikipedia.org/wiki

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Alex Rønne Petersen
On 11-03-2012 16:02, Alex Rønne Petersen wrote: On 11-03-2012 00:28, Philippe Sigaud wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. https://github.com/PhilippeSigaud/Pegged docs: https://github.com/PhilippeSigaud/Pegged/wiki PEG

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 00:34, Alex Rønne Petersenxtzgzo...@gmail.com wrote: [Parsing C?] I think so. But you'd have to do add some semantic action to deal with typedefs and macros. Oh, I should have mentioned I only meant the actual language (ignoring the preprocessor). OK. I admit I

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Philippe Sigaud
Quick question, you mention the ability to opt-out of the space-insensitivity, where might one find this? Yes, undocumented. Use the '' operator. You know, I introduced space-insensitivity recently, to simplify some rules and it keeps biting me back. For example Line - (!EOL .)* EOL The

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Philippe Sigaud
Also, I have sent a pull request to fix the build on 64-bit: https://github.com/PhilippeSigaud/Pegged/pull/1 Merged, thanks!

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Alex Rønne Petersen
On 11-03-2012 18:06, Philippe Sigaud wrote: On Sun, Mar 11, 2012 at 00:34, Alex Rønne Petersenxtzgzo...@gmail.com mailto:xtzgzo...@gmail.com wrote: [Parsing C?] I think so. But you'd have to do add some semantic action to deal with typedefs and macros. Oh, I should have mentioned I

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Philippe Sigaud
By the way, bootstrap.d seems to fail to build at the moment: ../pegged/utils/bootstrap.d(1433): found ':' when expecting ')' following template argument list ../pegged/utils/bootstrap.d(1433): members expected ../pegged/utils/bootstrap.d(1433): { } expected following aggregate declaration

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Philippe Sigaud
Hm, I don't *think* C has such ambiguities but I could well be wrong. In any case, if it can handle the non-ambiguous case, that's enough for me. I wanted to tackle D this week, but I might as well begin with C :) Do you happen to have any handy and readable EBNF grammar for C? At least for D,

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Alex Rønne Petersen
On 11-03-2012 18:19, Philippe Sigaud wrote: Hm, I don't *think* C has such ambiguities but I could well be wrong. In any case, if it can handle the non-ambiguous case, that's enough for me. I wanted to tackle D this week, but I might as well begin with C :) Do you happen to have any handy

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Alex Rønne Petersen
On 11-03-2012 18:17, Philippe Sigaud wrote: By the way, bootstrap.d seems to fail to build at the moment: ../pegged/utils/bootstrap.d(1433): found ':' when expecting ')' following template argument list ../pegged/utils/bootstrap.d(1433): members expected

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-11 Thread Alex Rønne Petersen
On 11-03-2012 00:28, Philippe Sigaud wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. https://github.com/PhilippeSigaud/Pegged docs: https://github.com/PhilippeSigaud/Pegged/wiki PEG: http://en.wikipedia.org/wiki

Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Philippe Sigaud
Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. https://github.com/PhilippeSigaud/Pegged docs: https://github.com/PhilippeSigaud/Pegged/wiki PEG: http://en.wikipedia.org/wiki/Parsing_expression_grammar The idea is to give the generator

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Alex Rønne Petersen
On 11-03-2012 00:28, Philippe Sigaud wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. https://github.com/PhilippeSigaud/Pegged docs: https://github.com/PhilippeSigaud/Pegged/wiki PEG: http://en.wikipedia.org/wiki

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Andrej Mitrovic
I see you are not the only one who started writing string array literals like this: enum PEGCode = grammarCode!( Grammar - S Definition+ EOI ,Definition - RuleName Arrow Expression ,RuleName - Identifier(ParamList?) ,Expression - Sequence (OR Sequence)* ); IOW comma on the

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread bearophile
Andrej Mitrovic: IOW comma on the left side. I know it's not a style preference but actually a (unfortunate but needed) technique for avoiding bugs. :) To avoid that bug: http://d.puremagic.com/issues/show_bug.cgi?id=3827 Bye, bearophile

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 00:34, Alex Rønne Petersen xtzgzo...@gmail.com wrote: Admittedly I have not heard of PEGs before, so I'm curious: Is this powerful enough to parse a language such as C? I think so. But you'd have to do add some semantic action to deal with typedefs and macros. People

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 00:56, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: I see you are not the only one who started writing string array literals like this: enum PEGCode = grammarCode!(     Grammar - S Definition+ EOI    ,Definition - RuleName Arrow Expression    ,RuleName   -

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Andrei Alexandrescu
On 3/11/12 1:22 AM, Philippe Sigaud wrote: On Sun, Mar 11, 2012 at 00:34, Alex Rønne Petersenxtzgzo...@gmail.com wrote: Admittedly I have not heard of PEGs before, so I'm curious: Is this powerful enough to parse a language such as C? I think so. But you'd have to do add some semantic

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Jonathan M Davis
On Sunday, March 11, 2012 00:28:42 Philippe Sigaud wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. Cool! PEGs aren't used all that much for language grammars - primarily because BNF and EBNF are more traditional I think - but they're

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 08:26, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I, too, think this is very significant work! Suggestion for Philippe: instead of this: enum PEGCode = grammarCode!(     Grammar - S Definition+ EOI    ,Definition - RuleName Arrow Expression    

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 08:26, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Any chance you consider adding AST generator actions as discussed in the main forum a while ago? The AST is automatically produced, and there are already AST actions to simplify / guide its creation. There

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 08:30, Jonathan M Davis jmdavisp...@gmx.com wrote: On Sunday, March 11, 2012 00:28:42 Philippe Sigaud wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator in D. Cool! PEGs aren't used all that much for language grammars

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Jonathan M Davis
On Sunday, March 11, 2012 08:39:47 Philippe Sigaud wrote: On Sun, Mar 11, 2012 at 08:30, Jonathan M Davis jmdavisp...@gmx.com wrote: On Sunday, March 11, 2012 00:28:42 Philippe Sigaud wrote: Hello, I created a new Github project, Pegged, a Parsing Expression Grammar (PEG) generator

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Andrei Alexandrescu
On 3/11/12 1:35 AM, Philippe Sigaud wrote: On Sun, Mar 11, 2012 at 08:26, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Splitting on ; is trivial and makes client code considerably easier to play with. It's already implemented! No need for ';' Great! I think you'd be wise to add

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 08:46, Jonathan M Davis jmdavisp...@gmx.com wrote: Is there an EBNF grammar for D somewhere, I mean outside the dlang docs? Someone may have been trying to write one, but I don't believe that there's an official one, and I recall someone complaining the the BNF grammar

Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-10 Thread Philippe Sigaud
On Sun, Mar 11, 2012 at 08:53, Philippe Sigaud philippe.sig...@gmail.com wrote: Anyway, the separating if done on the rule definitions  (Identifier - ...) Aw, I meant, the separation is done on rule definitions. Damn children climbing on me to get more breakfast :-)