- Timestamp:
- 10/12/08 18:11:36 (3 months ago)
- Location:
- misc
- Files:
-
- 1 removed
- 5 modified
-
elf/elf_h (modified) (2 diffs)
-
elf/elf_h_src/EmitSimpleP5.pm (modified) (1 diff)
-
elfish/STD_blue/Elfx.pm (deleted)
-
elfish/STD_blue/IRx1_FromAST2_create.pl (modified) (5 diffs)
-
elfish/STD_blue/Makefile (modified) (1 diff)
-
elfish/STD_blue/STD_blue_run (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
misc/elf/elf_h
r22560 r22589 288 288 $res 289 289 } 290 } 291 sub eval_perl5{ 292 my($p5,$env)=@_; 293 eval_runtime_code($p5,$env); 290 294 } 291 295 sub die{croak @_} … … 3228 3232 \ \ \ \ \}\ 3229 3233 \ \ \}\ 3234 \ \ sub\ eval_perl5\{\ 3235 \ \ \ \ my\(\$p5\,\$env\)\=\@_\;\ 3236 \ \ \ \ eval_runtime_code\(\$p5\,\$env\)\;\ 3237 \ \ \}\ 3230 3238 \ \ sub\ die\{croak\ \@_\}\ 3231 3239 \ \ sub\ exit\{CORE\:\:exit\(\@_\)\}\ -
misc/elf/elf_h_src/EmitSimpleP5.pm
r22560 r22589 321 321 $res 322 322 } 323 } 324 sub eval_perl5{ 325 my($p5,$env)=@_; 326 eval_runtime_code($p5,$env); 323 327 } 324 328 sub die{croak @_} -
misc/elfish/STD_blue/IRx1_FromAST2_create.pl
r22234 r22589 69 69 my $rule = $m.rule; 70 70 my $constructor = $.constructors{$rule}; 71 if ($constructor){71 if $constructor { 72 72 $constructor.($m); 73 73 } else { 74 die "Unknown rule: "~$rule~"\nIt needs to be added to ast_handlers.\n"; 74 my $g = $rule.re_groups('\A([^:]+):'); 75 if $g { $constructor = $.constructors{$g[0]} } 76 if $constructor { 77 $constructor.($m); 78 } else { 79 die "Unknown rule: "~$rule~"\nIt needs to be added to ast_handlers.\n"; 80 } 75 81 } 76 82 }; … … 106 112 } 107 113 }; 108 109 110 if not($*ast2ir_0) { $*ast2ir_0 = IRx1_Build2.new.init; }111 $*ast2ir_1 = IRx1_Build2.new.init;112 114 113 115 END_CODE … … 132 134 }; 133 135 134 method init { 135 136 END 136 END 137 my $init = ""; 137 138 138 139 my %seen; … … 142 143 die "Saw an AST handler for '$name' twice!\n" if $seen{$name}++; 143 144 144 $body =~ s{\s*=~\s*s/((?:[^\\\/]|\\.)*)/((?:[^\\\/]|\\.)*)/g;}{.re_gsub(rx:P5/$1/,"$2");}g;145 146 145 $body =~ s/\bir\(/irbuild_ir\(/g; 147 146 $body =~ s/(\$m(?:<\w+>)+)/irbuild_ir($1)/g; 148 147 $body =~ s/\$o((?:<\w+>)+)/\$m$1/g; 149 $body =~ s/<(\w+)>/. {'hash'}{'$1'}/g;148 $body =~ s/<(\w+)>/.hash{'$1'}/g; 150 149 $body =~ s/([A-Z]\w+\.new\w*)\(/IRx1::$1(\$m,/g; 151 150 $body =~ s/\*text\*/(\$m.match_string)/g; … … 154 153 $body = unindent(<<' END'," ").$body; 155 154 my $key; 156 for $m. {'hash'}.keys {155 for $m.hash.keys { 157 156 if $_ ne 'match' { 158 157 if $key { 159 die("Unexpectedly more than 1 field in NAME- dont know which to choose\n")158 die("Unexpectedly more than 1 field - dont know which to choose\n") 160 159 } 161 160 $key = $_; 162 161 } 163 162 } 164 my $one = irbuild_ir($m. {'hash'}{$key});163 my $one = irbuild_ir($m.hash{$key}); 165 164 END 166 $body =~ s/NAME/$name/;167 165 } 168 166 167 my $fname = $name; 168 $fname =~ s/(\W)/"_".ord($1)/eg; 169 169 $code .= "\n".unindent(<<" END"," "); 170 \$.add_constructor('$name',sub (\$m) {170 my \$construct_$fname = sub (\$m) { 171 171 $body; 172 } );172 }; 173 173 END 174 $init .= "".unindent(<<" END"," "); 175 \$.add_constructor('$name', \$construct_$fname); 176 END 174 177 175 178 } 176 179 $code .= unindent(<<" END"); 180 method init { 181 182 END 183 $code .= unindent(<<" END"); 184 $init 177 185 self; 178 186 }; # end init 179 } 187 }; 188 189 END 190 $code .= unindent(<<' END'); 191 192 if not($*ast2ir_0) { $*ast2ir_0 = IRx1_Build.new.init; } 193 $*ast2ir_1 = IRx1_Build.new.init; 194 180 195 END 181 196 open(F,">$file") or die $!; print F $code; close F; -
misc/elfish/STD_blue/Makefile
r22234 r22589 1 1 2 2 elfx:: 3 ELF_STD_RED_RUN=../../STD_red/STD_red_run ../../elf/elf_g -x -o ./elfx -I ../../elf/elf_g_src Elfx.pm3 ../../elf/elf_h -x -o ./elfx -I ../../elf/elf_h_src -e 'use Elf_wo_main' IRx1_FromAST2.pm Parser2.pm -e elf_main -
misc/elfish/STD_blue/STD_blue_run
r22586 r22589 144 144 sub to_dump0 { 145 145 my($o)=@_; 146 local $seen{$o} = $seen{$o}; 146 147 if($seen{$o}++ > $max_repetition) { return "LOOP:$o"->to_dump0 } 147 148 my $f = $o->{_from};
