js.pg in languages/ecmascript/src compiles just fine with pgc. But it
gives a "Null PMC access" error while using the compiled pir file. Is
it a pge bug?

$ cd languages/ecmascript/src

$ cat main.pir
.include 'errors.pasm'

.sub _main :main
   .param pmc args

   .local string source_code, rule_to_match
   source_code = args[1]
   rule_to_match = args[2]

   errorson .PARROT_ERRORS_PARAM_COUNT_FLAG

   load_bytecode 'PGE.pbc'
   load_bytecode 'dumper.pbc'
   load_bytecode 'PGE/Dumper.pbc'
   load_bytecode 'PGE/Text.pbc'
   load_bytecode 'Getopt/Obj.pbc'
   load_bytecode 'js.pir'

   .local pmc start_rule
   start_rule = get_global ['JS'], rule_to_match
   if null start_rule goto e_global_not_found

   .local pmc match
   match = start_rule(source_code)

   _dumper(match)
   branch end

 e_global_not_found:
   say "global not found"
 end:
.end

$ pgc js.pg >js.pir

$ parrot main.pir 'x' 'identifier'
Null PMC access in invoke()
current instr.: 'parrot;JS;identifier' pc 9096 (js.pir:3766)
called from Sub '_main' pc 38 (main.pir:24)

$ tail -n +3766 js.pir | line
         captob = $P0(captob)

$ parrot main.pir '[1]' 'array_literal'
Null PMC access in invoke()
current instr.: 'parrot;JS;array_literal' pc 11560 (js.pir:4711)
called from Sub '_main' pc 38 (main.pir:24)

$ tail -n +4711 js.pir | line
         captob = $P0(captob)

$ parrot main.pir '"test"' 'string_literal'
Null PMC access in invoke()
current instr.: 'parrot;JS;string_literal' pc 7460 (js.pir:3094)
called from Sub '_main' pc 38 (main.pir:24)

$ tail -n +3094 js.pir | line
         captob = $P0(captob, "\"")

$ parrot main.pir '/* test  */' 'multilinecomment'
Null PMC access in invoke()
current instr.: 'parrot;JS;multilinecomment' pc 816 (js.pir:349)
called from Sub '_main' pc 38 (main.pir:24)

$ tail -n +349 js.pir | line
         captob = $P0(captob, "/* */")


--
Mehmet

Reply via email to