[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: asking for advice for changing the cfengine.el progmode to support C
From: |
Ted Zlatanov |
Subject: |
Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x |
Date: |
Tue, 21 Jun 2011 14:26:24 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
On Tue, 21 Jun 2011 10:59:55 -0400 Stefan Monnier <address@hidden> wrote:
SM> The patch below will at least give you better feedback for the immediate
SM> problem in your grammar.
I hope you can commit it eventually.
>> See below. Perhaps I'm just too accustomed to LALR parsers, but they
>> seem easier and less ambiguous.
SM> Very likely. With SMIE you shouldn't try to parse the language in an
SM> exact manner, but think about parsing the minimum needed to indent
SM> properly ;-)
I tried, but I can't examine the parser state at a buffer point or do
anything else to debug the SMIE grammar. How do you do it? I'm used to
the Perl Parse::RecDescent module, which can show line-by-line parsing
traces and the actions taken.
If you could post more SMIE parser examples, it would be helpful. As I
said, I'm used to LALR grammars and the SMIE API plus the OPG grammars
themselves are a pretty big challenge.
I'm also surprised that Emacs doesn't have a decent LALR parser outside
Semantic, and Semantic itself is poorly documented as far as writing new
language support.
>> (bundle_body (bundle_section) (bundle_section "\n" bundle_section))
SM> I'm surprised to see \n here (and in the previous rule). Are newlines
SM> really significant in cfengine's syntax?
I thought they were the best way to separate sections. As far as the
syntax, newlines are separators but not operators, so I didn't do this
right.
SM> That means that
SM> bundle edit_line block_append_if_no_line(data)
SM> {
SM> insert_lines:
SM> any::
SM> "$(data)" insert_type => "preserve_block";
SM> }
SM> will be parsed as "bundle" followed by 4 <things> (one of them being
SM> "(data)"), which is structurally incorrect (IIUC "(data)" is actually
SM> structurally a child of "block_append_if_no_line" rather than of
SM> "bundle"), but we can hope that it won't matter for indentation.
Can you do a SMIE parser for the above to get me started? It would
really help. Or point me to an example that's similar to it.
Thanks
Ted
- asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Ted Zlatanov, 2011/06/17
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Stefan Monnier, 2011/06/17
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Ted Zlatanov, 2011/06/20
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Stefan Monnier, 2011/06/21
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x,
Ted Zlatanov <=
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Stefan Monnier, 2011/06/22
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Ted Zlatanov, 2011/06/22
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Ted Zlatanov, 2011/06/23
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Ted Zlatanov, 2011/06/27
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Ted Zlatanov, 2011/06/30
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Stefan Monnier, 2011/06/30
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Ted Zlatanov, 2011/06/30
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Stefan Monnier, 2011/06/30
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Ted Zlatanov, 2011/06/30
- Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x, Stefan Monnier, 2011/06/30