On Fri, Nov 10, 2006 at 08:23:56PM -0800, Chip Salzenberg via RT wrote:
> This *may* be a non-bug resulting from the conflation of PIR source
> file/line and HLL source file/line.
> 
> Or it may indicate the need for separate setfile/setline [HLL line] and
> #line <num> "<file>"  [PIR line].

I think it's likely the latter, but I'm not familiar enough with
this particular point to know for sure.

Here's the use case I'm trying to address:  The tgc and pgc compilers
currently translate source input files to PIR; and these sources
may contain PIR fragments which are to be copied directly into the
PIR output.  However, when imcc encouters an error in one of these
fragments, it reports the error as occuring on the line in the
PIR output instead of the line of the source input.

As an example, here's what an input file to tgc might look like:

    transform past (Perl6::Grammar) :language('PIR') {
        .local pmc cnode, cpast
        cnode = node['statement_list']
        cpast = tree.'get'('past', cnode, 'Perl6::Grammar::statement_list');
        .return (cpast)
    }

A programmer (or Makefile) compiles this into PIR with

    $ parrot compilers/tge/tgc.pir xyz.tg >xyz_gen.pir

and then compiling the xyz_gen.pir file results in

    $ parrot xyz_gen.pir
    error:imcc:syntax error, unexpected ';', expecting '\n'
        in file 'xyz_gen.pir' line 8
    $

Thus, it reports the error in the generated PIR file and
not the original source file.  The programmer then has to
look at the generated PIR file to find the offending line,
and then mentally back-translate into the original source
to correct it.

What I'd like to see instead is

    $ parrot xyz_gen.pir
    error:imcc:syntax error, unexpected ';', expecting '\n'
        in file 'xyz.tg' line 4

so that I can immediately find the problem in the original source
input file.

Pm

Reply via email to