For tene++; Not quite a test file, but I hope it will suffice.

Allison, can you comment on this, since TGE is yours?

% cat test.tg #simple .tg grammar
grammar TclExpr::PIR::Grammar is TGE::Grammar;

transform pir (Another::Nested::Namespace) {
    say "hello"
}
%../../parrot ../../compilers/tge/tgc.pir --output=test.pir test.tg
%cat test.pir #compiled version
.namespace [ 'TclExpr::PIR::Grammar' ]

.sub '__onload' :load :init
    load_bytecode 'TGE.pbc'
    push_eh class_loaded
    $P1 = subclass 'TGE::Grammar', 'TclExpr::PIR::Grammar'
    pop_eh
  class_loaded:

.end


.sub '_Another::Nested::Namespace_pir' :method
    .param pmc tree
    .param pmc node
#line 2 "test.tg"

    say "hello"

.end


.sub init :vtable :method
    self.add_rule('Another::Nested::Namespace', 'pir', '.',  '_Another::Nested::
Namespace_pir')

.end
%

The namespace of the generated file should be changed, the subclass
should probably be updated. (TGE itself should probably be updated to
not live a namespace with a '::' in it. The actual transform sub can
keep the name it has, but the first parameter to add_rule() should
probably be updated as well. This /should/ work with the new automatic
translation of :: that PGE is doing.


-- 
Will "Coke" Coleda

Reply via email to