Are you suggesting that CEDET parse the .pir files, and use them to do
That sounds like an interesting idea. I don't know why it can't work,
but someone would have to give it a try to know for sure.
Can the output style of parrot be changed to Emacs Lisp, or is it stuck
in it's own format?
On 05/24/2010 08:49 PM, Lennart Borgman wrote:
> On Tue, May 25, 2010 at 2:18 AM, Eric M. Ludlam<eric@...> wrote:
>> On 05/24/2010 06:58 AM, Lennart Borgman wrote:
>>> Can the Parrot grammar files (.PGE or .PRI) be used by CEDET in some
>>> way for completion etc?
>> As yary suggested, if you create some parser using parrot as a
>> standalone parser, it can be used by CEDET. The cedet/semantic/ctags
>> code is an example of using exuberent ctags as a parser for C/C++ (out
>> of process parsing) or for several other languages as the only parser.
>> CEDET prefers much more detailed tags than what ctags can create. If
>> there is a pre-existing parrot grammar that can be tweaked to dump out
>> Emacs Lisp tag tables, then they could be slurped in directly.
>> If Parrot can dump out a parser implemented AS Emacs Lisp, as opposed to
>> a standalone parser that itself parses a file into Emacs Lisp, then that
>> would be pretty cool, but I don't have a model for that, other than
>> perhaps the html/texi stuff.
> I do not understand this, but perhaps the .pir files can be written in
> another way so that they could be used. Here is an example
> =head1 TITLE
> lolcode.pir - A lolcode compiler.
> =head2 Description
> This is the base file for the lolcode compiler.
> This file includes the parsing and grammar rules from
> the src/ directory, loads the relevant PGE libraries,
> and registers the compiler under the name 'lolcode'.
> =head2 Functions
> =over 4
> =item onload()
> Creates the lolcode compiler using a C<PCT::HLLCompiler>
> .HLL 'lolcode'
> .namespace [ 'lolcode';'Compiler' ]
> .sub '' :anon :load
> load_bytecode 'PCT.pbc'
> .local pmc parrotns, lolns, exports
> parrotns = get_root_namespace ['parrot']
> lolns = get_hll_namespace
> exports = split ' ', 'PAST PCT PGE P6metaclass'
> parrotns.'export_to'(lolns, exports)
> .include 'src/builtins.pir'
> .include 'src/gen_grammar.pir'
> .include 'src/parser/yarn_literal.pir'
> .include 'src/gen_actions.pir'
> .sub 'onload' :anon :load
> $P0 = new 'ResizablePMCArray'
> set_hll_global ['lolcode';'Grammar';'Actions'], '@?BLOCK', $P0
> $P0 = new ['PAST';'Stmts']
> set_hll_global ['lolcode';'Grammar';'Actions'], '$?BLOCK_SIGNATURE', $P0
> $P0 = get_hll_global ['PCT'], 'HLLCompiler'
> $P1 = $P0.'new'()
> $P0 = get_hll_namespace ['lolcode';'Grammar']
> $P0 = get_hll_namespace ['lolcode';'Grammar';'Actions']
> This is part of the parser. It is automatically built from a .PEG (or
> was it .pge?) grammar file if I understand it correctly. It looks like
> the building process dumps some built in files and then writes this
> specific files like this one.
> I am not able to see where it dumps things or whether it can be used
> for restartable parsing (for completion from the grammar + tags).
> Maybe you can guess better?
> However what is needed (in case it can be used) to use this is either
> to translate the parser builder that reads the grammar and make that
> grammar reader write elisp instead of .pir files. Or, rewrite the
> output format from the grammar reader.
> If it can be used then there is a large amount of grammar files
> written for different languages. It looks like a huge resource.
> Cedet-devel mailing list