Author: pmichaud
Date: Wed Jun 13 11:00:20 2007
New Revision: 18978
Modified:
trunk/languages/perl6/config/makefiles/root.in
trunk/languages/perl6/src/parser/grammar_rules.pg
Log:
[perl6]:
* Convert grammar_rules.pg to use new S05 quoting syntax.
* Switch from using pgc.pir to Perl6Grammar.pir (and Perl6Regex).
Modified: trunk/languages/perl6/config/makefiles/root.in
==============================================================================
--- trunk/languages/perl6/config/makefiles/root.in (original)
+++ trunk/languages/perl6/config/makefiles/root.in Wed Jun 13 11:00:20 2007
@@ -7,13 +7,13 @@
PARROT = ../../[EMAIL PROTECTED]@
BUILD = $(PERL) @build_dir@/tools/build/dynpmc.pl
TOOL_DIR = ../..
-PGE_DIR = ../../compilers/pge
TGE_DIR = ../../compilers/tge
CAT = $(PERL) -MExtUtils::Command -e cat
CP = @cp@
O = @o@
LOAD_EXT = @load_ext@
PARROT_DYNEXT = @build_dir@/runtime/parrot/dynext
+PGE_LIBRARY = @build_dir@/runtime/parrot/library/PGE
PMCDIR = src/pmc
@@ -52,8 +52,9 @@
PMC_SOURCES = $(PMCDIR)/perl6str.pmc
# the default target
-perl6.pbc: $(PARROT) $(PGE_DIR)/pgc.pir $(SOURCES)
- $(PARROT) $(PGE_DIR)/pgc.pir --output=src/parser/grammar_gen.pir \
+perl6.pbc: $(PARROT) $(PGE_LIBRARY)/Perl6Grammar.pir $(SOURCES)
+ $(PARROT) $(PGE_LIBRARY)/Perl6Grammar.pir \
+ --output=src/parser/grammar_gen.pir \
src/parser/grammar_rules.pg src/parser/grammar_optok.pg
$(PARROT) $(TGE_DIR)/tgc.pir --output=src/PAST/Grammar_gen.pir
src/PAST/Grammar.tg
$(PARROT) -o perl6.pbc perl6.pir
Modified: trunk/languages/perl6/src/parser/grammar_rules.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar_rules.pg (original)
+++ trunk/languages/perl6/src/parser/grammar_rules.pg Wed Jun 13 11:00:20 2007
@@ -35,9 +35,9 @@
}
regex pod_comment {
- ^^ = [ [ cut \h*: | end [\h\N*]? ]
+ ^^ '=' [ [ cut \h*: | end [\h\N*]? ]
| for [ \h\N+: ] \n [ \N+\n ]*:
- | \w\N*: \n .*? \n = [ cut \h*: | end [\h\N*:]? ]
+ | \w\N*: \n .*? \n '=' [ cut \h*: | end [\h\N*:]? ]
]
[\n|$]
}
@@ -54,7 +54,7 @@
token statement_end {
- | [ <?ws> ; ]+
+ | [ <?ws> ';' ]+
| <after \}> :: \h* [ \#\N* ]? \n
}
@@ -90,7 +90,7 @@
| $<KEY>:=[while|until] <expression: {> <block>
| $<KEY>:=[repeat] <block>
[ <?ws>: [while|until] <expression: ;> ]
- | $<KEY>:=[loop] [ \( <expression> ; <expression> ; <expression> \) ]?
+ | $<KEY>:=[loop] [ \( <expression> ';' <expression> ';' <expression> \) ]?
<block>
| $<KEY>:=[for] <expression> <pblock>
]
@@ -101,7 +101,7 @@
}
token pblock {
- <?ws> [<'->'> <?ws> <signature> <?ws>]? <block>
+ <?ws> [ '->' <?ws> <signature> <?ws>]? <block>
}
token block {
@@ -165,7 +165,7 @@
token dot { \. | [ \\ <?ws> ]? \. }
-token postfix { $<KEY>:=[\+\+|--] }
+token postfix { $<KEY>:=[\+\+|\-\-] }
token postcircumfix {
| $<KEY>:=[\(] <?ws> <expression>? <?ws> $<KEY_CLOSE>:=[\)]
@@ -186,7 +186,7 @@
## This is a temporary rule that allows parsing of /regex/
## in term position. It is likely to change.
-token regex_term { / <regex: /> / }
+token regex_term { '/' <regex: /> '/' }
rule scoped_variables {
<scope_declarator> <variable>
@@ -198,17 +198,17 @@
rule class_block {
<scope_declarator>?
<class_declarator>
- $<name>:=[ <'::'>? <name> [ - <version_number> ]? | <?null> ]
- [ ; | <block> ]
+ $<name>:=[ '::'? <name> [ '-' <version_number> ]? | <?null> ]
+ [ ';' | <block> ]
}
## XXX: These are just placeholder regexes for demonstration,
## they certainly need to be expanded to be more complete.
token twigil { <[.^*+?=!]> }
-token variable { \$! | \$/ | \$_ | <sigil> <twigil>? <name> }
-token sigil { <[EMAIL PROTECTED]&]> | <'::'> }
-token name { <ident> [ <'::'> <ident> ]* }
+token variable { '$!' | '$/' | '$_' | <sigil> <twigil>? <name> }
+token sigil { <[EMAIL PROTECTED]&]> | '::' }
+token name { <ident> [ '::' <ident> ]* }
token version_number { \d+ \. \d+ \. \d+ }
token integer {
@@ -224,11 +224,11 @@
\d+[_\d+]* [ \. \d+[_\d+]* [ <[Ee]> <[+\-]>? \d+ ]? ]
}
-token type_name { [ <'::'> ? <[A..Z]> <[0..9a..z_]>* ]+ }
+token type_name { [ '::' ? <[A..Z]> <[0..9a..z_]>* ]+ }
token quote_term {
- | $<KEY>:=['] <quote_expression> '
- | $<KEY>:=["] <quote_expression> "
+ | $<KEY>:=[\'] <quote_expression> \'
+ | $<KEY>:=[\"] <quote_expression> \"
| $<KEY>:=[\<\<] <quote_expression> \>\>
| $<KEY>:=[\<] <quote_expression> \>
}
@@ -275,9 +275,9 @@
}
rule signature {
- $<invocant>:=(<parameter> <':'>)?
- $<paramlist>:=(<parameter>? [, <parameter>]*)
- [ <'-->'> $<rettype>:=<type> ]?
+ $<invocant>:=(<parameter> ':')?
+ $<paramlist>:=(<parameter>? [',' <parameter>]*)
+ [ '-->' $<rettype>:=<type> ]?
}
## XXX: <parameter> needs expansion for the various