Author: pmichaud
Date: Tue May  3 11:38:15 2005
New Revision: 7962

Added:
   trunk/runtime/parrot/library/PGE/Dumper.pir
Removed:
   trunk/runtime/parrot/library/PGE.pir
Modified:
   trunk/MANIFEST
   trunk/config/gen/makefiles/pge.in
Log:
Er, the rest of the commit.


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Tue May  3 11:38:15 2005
@@ -126,12 +126,11 @@
 classes/vtablecache.pmc                                  []
 compilers/pge/README                              []
 compilers/pge/demo.pir                            []
-compilers/pge/pge.h                               []
-compilers/pge/pge_gen.c                           []
-compilers/pge/pge_opt.c                           []
-compilers/pge/pge_parse.c                         []
-compilers/pge/pge_parseglob.c                     []
-compilers/pge/pge_parsep5.c                       []
+compilers/pge/PGE.pir                             []
+compilers/pge/PGE/Exp.pir                         [] 
+compilers/pge/PGE/Match.pir                       [] 
+compilers/pge/PGE/P6Rule.pir                      [] 
+compilers/pge/PGE/TokenHash.pir                   [] 
 config/auto/aio.pl                                []
 config/auto/aio/aio.in                            []
 config/auto/alignptrs.pl                          []
@@ -1519,8 +1518,8 @@
 runtime/parrot/library/Data/Dumper/Default.imc    [library]
 runtime/parrot/library/Digest/MD5.imc             [library]
 runtime/parrot/library/PGE/Class.pir              [library]
+runtime/parrot/library/PGE/Dumper.pir             [library]
 runtime/parrot/library/PGE/RegCounter.pir         [library]
-runtime/parrot/library/PGE.pir                    [library]
 runtime/parrot/library/SDL.imc                    [library]
 runtime/parrot/library/SDL/App.imc                [library]
 runtime/parrot/library/SDL/Button.imc             [library]

Modified: trunk/config/gen/makefiles/pge.in
==============================================================================
--- trunk/config/gen/makefiles/pge.in   (original)
+++ trunk/config/gen/makefiles/pge.in   Tue May  3 11:38:15 2005
@@ -8,49 +8,23 @@
 CP       = ${cp}
 
 # Where to put things
-PARROT_RUNTIME    = ..${slash}..${slash}runtime${slash}parrot${slash}dynext
-
-# Compile commands and flags
-CC        = ${cc}
-CC_SHARED = ${cc_shared} # e.g. -fpic
-DEBUG     = ${cc_debug}
-WARN      = ${ccwarn}
-CFLAGS    = ${ccflags} $(CC_SHARED) -I..${slash}..${slash}include $(DEBUG) 
$(WARN)
-O        = ${o}
-
-# Linker command and flags
-LINK      = ${link}
-LINKFLAGS = ${linkflags}
-
-# Shared-library and dynamically-loadable module building
-# XXX Which one is this?
-LD        = ${ld}
-LDFLAGS   = ${ldflags}
-LD_SHARE_FLAGS = ${ld_share_flags} # e.g. -shared
-SO        = ${share_ext}
-LD_LOAD_FLAGS = ${ld_load_flags}
+PARROT_LIBRARY    = ..${slash}..${slash}runtime${slash}parrot${slash}library
 
 # the default target
-all: $(PARROT_RUNTIME)${slash}pge$(SO)
-
-$(PARROT_RUNTIME)${slash}pge$(SO): pge$(SO)
-       $(CP) pge$(SO) $(PARROT_RUNTIME)
+all: $(PARROT_LIBRARY)${slash}PGE.pbc
 
-pge$(SO): pge_parse$(O) pge_gen$(O) pge_opt$(O) pge_parsep5$(O) 
pge_parseglob$(O)
-       $(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) -o pge$(SO) pge_parse$(O) 
pge_gen$(O) pge_opt$(O) pge_parsep5$(O) pge_parseglob$(O)
+$(PARROT_LIBRARY)${slash}PGE.pbc: PGE.pbc
+       $(CP) PGE.pbc $(PARROT_LIBRARY)
 
-pge_gen$(O): pge_gen.c pge.h
-pge_parse$(O): pge_parse.c pge.h
-pge_parsep5$(O): pge_parsep5.c pge.h
-pge_parseglob$(O): pge_parseglob.c pge.h
-pge_opt$(O): pge_opt.c pge.h
+PGE.pbc: PGE.pir PGE/Exp.pir PGE/Match.pir PGE/P6Rule.pir PGE/TokenHash.pir
+       $(PARROT) --output-pbc PGE.pir >PGE.pbc
 
 # This is a listing of all targets, that are meant to be called by users
 help:
        @echo ""
        @echo "Following targets are available for the user:"
        @echo ""
-       @echo "  all:               pge.so"
+       @echo "  all:               PGE.pbc"
        @echo "                     This is the default."
        @echo "Testing:"
        @echo "  test:              Run the test suite."
@@ -72,7 +46,7 @@
        $(RM_RF) ../../t/p6rules/*.imc ../../t/p6rules/*.pasm
 
 clean: testclean
-       $(RM_RF) *$(O) pge$(SO)
+       $(RM_RF) PGE.pbc
 
 realclean: clean
        $(RM_RF) Makefile

Added: trunk/runtime/parrot/library/PGE/Dumper.pir
==============================================================================
--- (empty file)
+++ trunk/runtime/parrot/library/PGE/Dumper.pir Tue May  3 11:38:15 2005
@@ -0,0 +1,156 @@
+=head1 TITLE
+
+PGE::Dumper - various methods for displaying PGE structures
+
+=cut
+
+.namespace [ "PGE::Exp" ]
+
+.sub "dumpindent" method
+    .param int indent
+    $S0 = repeat ' ', indent
+    print $S0
+.end
+
+.sub "dump" method
+    .param int indent
+    self."dumpindent"(indent)
+    print "EXP (abstract) "
+    $S0 = self."quant"()
+    print $S0
+    print "\n"
+.end
+
+.namespace [ "PGE::Exp::Start" ]
+
+.sub dump method
+    .param int indent
+    .local pmc exp1
+    exp1 = self["exp1"]
+    exp1."dump"(0)
+.end
+
+.namespace [ "PGE::Exp::End" ]
+
+.sub dump method
+    .param int indent
+    self."dumpindent"(indent)
+    print "End\n"
+.end
+
+.namespace [ "PGE::Exp::Literal" ]
+
+.sub "dump" method
+    .param int indent
+    .local pmc literal
+    literal = self["literal"]
+    self."dumpindent"(indent)
+    print "LITERAL �"
+    print literal
+    print "� "
+    $S0 = self."quant"()
+    print $S0
+    print "\n"
+.end
+
+.namespace [ "PGE::Exp::Dot" ]
+
+.sub "dump" method
+    .param int indent
+    self."dumpindent"(indent)
+    print "DOT "
+    $S0 = self."quant"()
+    print $S0
+    print "\n"
+.end
+
+
+.namespace [ "PGE::Exp::Anchor" ]
+
+.sub "dump" method
+    .param int indent
+    .local string token
+    self."dumpindent"(indent)
+    print "ANCHOR "
+    token = self["token"]
+    print token
+    print "\n"
+.end
+
+
+.namespace [ "PGE::Exp::Concat" ]
+
+.sub "dump" method
+    .param int indent
+    $P0 = self["exp1"]
+    $P0."dump"(indent)
+    $P0 = self["exp2"]
+    $P0."dump"(indent)
+.end
+
+.namespace [ "PGE::Exp::Alt" ]
+
+.sub "dump" method
+    .param int indent
+    .local int offset
+    .local pmc exp
+
+    exp = self["exp1"]
+    $I1 = indent
+    $I0 = isa exp, "PGE::Exp::Alt"
+    if $I0 goto print_exp1
+    $I1 += 4
+  print_exp1:
+    exp."dump"($I1)
+    self."dumpindent"(indent)
+    print "ALT\n"
+    exp = self["exp2"]
+    $I1 = indent
+    $I0 = isa exp, "PGE::Exp::Alt"
+    if $I0 goto print_exp2
+    $I1 += 4
+  print_exp2:
+    exp."dump"($I1)
+.end
+
+
+.namespace [ "PGE::Exp::Group" ]
+
+.sub "dump" method
+    .param int indent
+    .local int offset
+    .local pmc exp
+    .local int subp
+
+    self."dumpindent"(indent)
+    print "GROUP "
+    $S0 = self."quant"()
+    print $S0
+    $I0 = exists self["rname"]
+    unless $I0 goto dump_0
+    print "subrule '"
+    $S0 = self["rname"]
+    print $S0
+    print "'"
+  dump_0:
+    $I0 = exists self["cname"]
+    unless $I0 goto dump_1
+    print " capture as '"
+    $S0 = self["cname"]
+    print $S0
+    print "'"
+  dump_1:
+    $I0 = self["isarray"]
+    unless $I0 goto dump_2
+    print " isarray"
+  dump_2:
+    $I0 = self["cscope"]
+    unless $I0 goto dump_3
+    print " cscope"
+  dump_3:
+    print "\n"
+    exp = self["exp1"] 
+    indent += 4
+    exp."dump"(indent)
+.end
+

Reply via email to