--- compilers/pct/src/PCT/HLLCompiler.pir.old	2010-05-30 15:09:36.000000000 +0200
+++ compilers/pct/src/PCT/HLLCompiler.pir	2010-06-02 02:28:21.000000000 +0200
@@ -386,14 +386,19 @@
     goto tcode_loop
   transcode_done:
 
-    .local string target
+    .local string target, entry_rule
+
+    entry_rule = adverbs['rule']
+    if entry_rule != '' goto got_rule
+    entry_rule = 'TOP'
+  got_rule:
     target = adverbs['target']
     target = downcase target
 
     parsegrammar = self.'parsegrammar'()
-    $I0 = can parsegrammar, 'TOP'
+    $I0 = can parsegrammar, entry_rule
     unless $I0 goto parsegrammar_string
-    top = find_method parsegrammar, 'TOP'
+    top = find_method parsegrammar, entry_rule
     goto have_top
   parsegrammar_string:
     $S0 = typeof parsegrammar
@@ -401,20 +406,20 @@
     $P0 = self.'parse_name'(parsegrammar)
     $S0 = pop $P0
     $P1 = get_hll_global $P0, $S0
-    $I0 = can $P1, 'TOP'
+    $I0 = can $P1, entry_rule
     unless $I0 goto parsegrammar_ns_string
-    top = find_method $P1, 'TOP'
+    top = find_method $P1, entry_rule
     goto have_top
   parsegrammar_ns_string:
     $P0 = self.'parse_name'(parsegrammar)
-    top = get_hll_global $P0, 'TOP'
+    top = get_hll_global $P0, entry_rule
     unless null top goto have_top
     goto err_notop
   parsegrammar_ns:
-    top = parsegrammar['TOP']
+    top = parsegrammar[entry_rule]
     unless null top goto have_top
   err_notop:
-    self.'panic'('Cannot find TOP regex in ', parsegrammar)
+    self.'panic'("Cannot find '", entry_rule, "'regex in ", parsegrammar)
   have_top:
     .local pmc parseactions, action
     null action
