Changeset 7867
- Timestamp:
- 11/06/05 01:46:36 (3 years ago)
- Files:
-
- 7 modified
-
perl5/PIL-Run/lib/PIL/Run/EvalX.pm (modified) (2 diffs)
-
perl5/PIL2JS/README (modified) (4 diffs)
-
perl5/PIL2JS/lib/PIL/Parser.pm (modified) (2 diffs)
-
perl5/PIL2JS/lib/PIL2JS.pm (modified) (4 diffs)
-
perl5/PIL2JS/pil2js.pl (modified) (1 diff)
-
src/Pugs.hs (modified) (1 diff)
-
src/Pugs/CodeGen.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
perl5/PIL-Run/lib/PIL/Run/EvalX.pm
r7153 r7867 289 289 } 290 290 my $extra_args = $main::pugs_args ? $main::pugs_args : ""; #XXX- kludge 291 my $cmd = "$pugs $extra_args $dir -CP erl5 $fn";291 my $cmd = "$pugs $extra_args $dir -CPIL1-Perl5 $fn"; 292 292 my $pil = `$cmd`; #die if $!; 293 293 unlink $fn or die "Couldn't remove \"$fn\": $!\n"; … … 306 306 my($pil)=@_; 307 307 my $pilc = eval($pil); 308 die "Eval of -CP erl5 code failed. $@" if $@;308 die "Eval of -CPIL1-Perl5 code failed. $@" if $@; 309 309 $pilc; 310 310 } -
perl5/PIL2JS/README
r7663 r7867 6 6 7 7 C<pil2js.pl> is a Perl 5 program which takes PIL as input (as given by C<pugs 8 -CP erl5>) and outputs JavaScript.8 -CPIL1-Perl5>) and outputs JavaScript. 9 9 10 10 =head1 USAGE … … 49 49 | |-- PIL.pm Main compiler modules, uses all other PIL:: modules 50 50 | |-- PIL 51 | | |-- Parser.pm PIL::Parser (parses the output of -CP erl5)51 | | |-- Parser.pm PIL::Parser (parses the output of -CPIL1-Perl5) 52 52 | | `-- <PIL nodetype>.pm 53 53 | | Backend compiler modules … … 440 440 441 441 # Compile the Perl 6 to PIL 442 $ pugs -CP erl5 -we '442 $ pugs -CPIL1-Perl5 -we ' 443 443 $*JS::JSAN.addRepository("/tmp/jsanlibs"); 444 444 use jsan:Number.Roman <to_roman>; … … 568 568 =item * 569 569 570 Don't call all subs in list context -- but to fix this reliably, C<-CP erl5> has570 Don't call all subs in list context -- but to fix this reliably, C<-CPIL1-Perl5> has 571 571 to give better context information. 572 572 -
perl5/PIL2JS/lib/PIL/Parser.pm
r7624 r7867 1 1 package PIL::Parser; 2 # This module takes the output of pugs -CP erl5, eval()s it, and reblesses most2 # This module takes the output of pugs -CPIL1-Perl5, eval()s it, and reblesses most 3 3 # objects (we want PIL::PVal, not PVal). 4 4 … … 20 20 21 21 my $struct = eval $str; 22 die "Couldn't parse -CP erl5 output: $@\n" if $@;22 die "Couldn't parse -CPIL1-Perl5 output: $@\n" if $@; 23 23 Class::Rebless->custom($struct, "PIL", { editor => sub { 24 24 my ($obj, $namespace) = @_; -
perl5/PIL2JS/lib/PIL2JS.pm
r7601 r7867 66 66 preludepc_check(); 67 67 68 my $pil = run_pugs("-CP erl5", @_);68 my $pil = run_pugs("-CPIL1-Perl5", @_); 69 69 die "Error: Couldn't compile to PIL!\n" if not defined $pil; 70 70 my $mini = run_pil2js(\$pil); … … 75 75 76 76 sub compile_perl6_to_mini_js { 77 my $pil = run_pugs("-CP erl5", @_);77 my $pil = run_pugs("-CPIL1-Perl5", @_); 78 78 die "Error: Couldn't compile to PIL!\n" if not defined $pil; 79 79 … … 95 95 96 96 sub precomp_module_to_mini_js { 97 my $pil = eval { run_pugs("-CP erl5", @_, "-e", "''") };97 my $pil = eval { run_pugs("-CPIL1-Perl5", @_, "-e", "''") }; 98 98 die $@ if $@; 99 99 my $js = eval { run_pil2js("-v", \$pil) }; … … 103 103 104 104 sub compile_perl6_to_pil { 105 my $pil = run_pugs("-CP erl5", @_);105 my $pil = run_pugs("-CPIL1-Perl5", @_); 106 106 die "Error: Couldn't compile to PIL!\n" if not defined $pil; 107 107 return $pil; -
perl5/PIL2JS/pil2js.pl
r7446 r7867 56 56 57 57 my $pil = $input[0] =~ /\.(?:pl|p6|pm|p6m|t)$/i 58 ? decode "utf-8", run_pugs("-CP erl5", $input[0])58 ? decode "utf-8", run_pugs("-CPIL1-Perl5", $input[0]) 59 59 : slurp $input[0]; 60 60 my $tree = PIL::Parser->parse($pil); -
src/Pugs.hs
r7479 r7867 78 78 run ("-c":file:_) = readFile file >>= doCheck file 79 79 80 -- -CPerl5 outputs PIL formatted as Perl 5, PIL-Run is not involved. 81 -- Should we rename -CPerl5, -CJSON etc. to -CPIL.Perl5, -CPIL.JSON etc.? 80 -- -CPIL1.Perl5 outputs PIL formatted as Perl 5. 82 81 run ("-C":backend:args) | map toUpper backend == "JS" = do 83 82 exec <- getArg0 -
src/Pugs/CodeGen.hs
r7866 r7867 29 29 generators = Map.fromList $ 30 30 [ ("GHC", genGHC) 31 , ("Parrot", genPIR)32 31 , ("PIR", genPIR) 33 32 , ("PIL1", genPIL1) 33 , ("PIL1-Perl5", genPerl5) 34 , ("PIL1-Binary", genBinary) 35 , ("PIL1-JSON", genJSON) 34 36 , ("PIL2", genPIL2) 35 37 , ("PIL2-Perl5", genPIL2Perl5) 36 38 , ("PIL2-JSON", genPIL2JSON) 37 39 , ("PIL2-Binary", genPIL2Binary) 38 , ("Perl5", genPerl5)39 40 , ("Pugs", genPugs) 40 , ("Binary", genBinary)41 , ("JSON", genJSON)42 41 -- , ("XML", genXML) 43 42 ] … … 50 49 where 51 50 norm' "ghc" = "GHC" 52 norm' "parrot" = " Parrot"51 norm' "parrot" = "!PIR" 53 52 norm' "pir" = "PIR" 54 norm' "pil" = " PIL1" -- XXX - this will change53 norm' "pil" = "!PIL1" 55 54 norm' "pil1" = "PIL1" 56 55 norm' "pil2" = "PIL2" 57 norm' "perl5" = "Perl5" 56 norm' "perl5" = "!PIL1-Perl5" 57 norm' "binary" = "!PIL1-Binary" 58 norm' "json" = "!PIL1-JSON" 59 norm' "pil1perl5" = "PIL1-Perl5" 60 norm' "pil1json" = "PIL1-JSON" 61 norm' "pil1binary" = "PIL1-Binary" 58 62 norm' "pil2perl5" = "PIL2-Perl5" 59 63 norm' "pil2json" = "PIL2-JSON" 60 64 norm' "pil2binary" = "PIL2-Binary" 61 65 norm' "pugs" = "Pugs" 62 norm' "binary" = "Binary"63 norm' "json" = "JSON"64 66 -- norm' "xml" = "XML" 65 67 norm' x = x 66 68 67 69 doLookup :: String -> IO Generator 68 doLookup s = Map.lookup (norm s) generators 70 doLookup s = do 71 case norm s of 72 ('!':key) -> do 73 putStrLn $ "*** The backend '" ++ s ++ "' is deprecated." 74 putStrLn $ " Please use '" ++ key ++ "' instead." 75 Map.lookup key generators 76 key -> Map.lookup key generators 69 77 70 78 codeGen :: String -> Env -> IO String
