Permalink
Browse files

Remove all lexical handling from grammar.

  • Loading branch information...
sorear committed Jun 15, 2011
1 parent 55018cb commit a94e021da56a30ad5202e7aea198aae8aacdbbee
Showing with 184 additions and 1,621 deletions.
  1. +5 −5 Makefile
  2. +1 −11 TODO
  3. +0 −81 src/Metamodel.pm6
  4. +0 −14 src/NAME.pm6
  5. +5 −3 src/NieczaActions.pm6
  6. +0 −229 src/NieczaFrontendSTD.pm6
  7. +172 −732 src/STD.pm6
  8. +0 −12 src/Stash.pm6
  9. +1 −367 src/niecza
  10. +0 −167 src/tryfile
View
@@ -16,11 +16,11 @@ csxdr=CrossDomainReceiver.cs
.PHONY: help
libunits=CORE JSYNC
-srcunits=CClass CgOp Op OpHelpers Sig RxOp NAME Stash STD NieczaGrammar \
- Metamodel OptRxSimple NAMOutput Operator NieczaActions \
- NieczaFrontendSTD NieczaPassSimplifier OptBeta NieczaPathSearch \
- NieczaBackendNAM NieczaBackendDotnet NieczaBackendClisp \
- NieczaBackendHoopl NieczaCompiler GetOptLong
+srcunits=CClass CgOp Op OpHelpers Sig RxOp STD NieczaGrammar Metamodel \
+ OptRxSimple NAMOutput Operator NieczaActions NieczaFrontendSTD \
+ NieczaPassSimplifier OptBeta NieczaPathSearch NieczaBackendNAM \
+ NieczaBackendDotnet NieczaBackendClisp NieczaBackendHoopl \
+ NieczaCompiler GetOptLong
all: run/Niecza.exe obj/Kernel.dll obj/CORE.nam obj/CLRBackend.exe
@git describe --tags > VERSION
View
12 TODO
@@ -98,17 +98,6 @@ NASTY
Export Perl 6 code into a CLR .dll
-STD $*CURLEX consumers:
- - getsig
-(also do add_our_name)
-
-<used>:
- - param_var
- - getsig
- - add_my_name
- - add_our_name
- - add_placeholder
-
Other stuff to do after:
- $_ handling: declare in *every* sub, empty/defouter according to returnable
- cnperl6 prototyping...
@@ -117,4 +106,5 @@ Other stuff to do after:
- fix stubbing of qualified packages
- fix { my $x } crash
- blast/statement_level
+ - checking redeclaration of our symbols, methods, attributes...
- is tighter/looser/equiv
View
@@ -2,9 +2,6 @@
class Metamodel;
-use NAME;
-use Stash;
-
method locstr($fo, $lo, $fn, $ln) {
$fo := $fo // '???';
$lo := $lo // '???';
@@ -788,82 +785,4 @@ class Unit {
$.ns.add_from($u2name);
$u2;
}
-
- # STD-based frontend wants a slightly different representation.
- sub _syml_myname($xr) { "MY:unit<$xr[0]>:xid<$xr[1]>" }
-
- method create_syml($from_sub?) {
- my $all = {};
- my $*unit = self;
-
- if (self.get_unit($.name) !=== self) {
- die "Local unit cache inconsistant";
- }
-
- $.ns.visit_stashes(sub (@path) {
- return Nil unless @path;
- my $tag = join("", map { $_ ~ "::" }, @path);
- my $st = $all{$tag} = Stash.new('!id' => [$tag]);
- my @ppath = @path;
- my $name = pop @ppath;
- my $ptag = join("", map { $_ ~ "::" }, @ppath);
- if $ptag ne '' {
- $st<PARENT::> = [ $ptag ];
- $all{$ptag}{$name ~ '::'} = $st;
- }
- for self.list_stash(@path) -> $tok {
- if $tok[1] eq 'var' {
- my $name = $tok[0];
- $st{$name} = NAME.new( name => $name );
- $st{'&' ~ $name} = $st{$name} if $name !~~ /^<[\$\@\%\&]>/;
- }
- }
- });
-
- my $top = $from_sub // self.deref($.bottom_ref // $.mainline.xref);
- #say STDERR "Top = $top";
- my $cursor = $top;
- while $cursor {
- my $id = _syml_myname($cursor.xref);
- #say STDERR "Creating $cursor [$id]";
- $all{$id} = Stash.new( '!id' => [ $id ] );
- $cursor = $cursor.outer;
- }
-
- $cursor = $top;
- while $cursor {
- my $st = $all{_syml_myname($cursor.xref)};
- #say STDERR "Populating $cursor";
- for sort keys $cursor.lexicals -> $name {
- my $lx = $cursor.lexicals{$name};
- $st{$name} = NAME.new( name => $name );
- $st{'&' ~ $name} = $st{$name} if $name !~~ /^<[\$\@\%\&]>/;
-
- if $lx.^isa(Metamodel::Lexical::Stash) {
- my @cpath = $.ns.stash_canon($lx.path);
- $st{$name ~ '::'} = $all{join "", map { $_ ~ "::" },
- $.ns.stash_canon(@cpath)};
- }
- }
- $st<OUTER::> = $cursor.outer ?? $all{_syml_myname($cursor.outerx)}<!id> !! [];
- if ($cursor.unit.bottom_ref && $cursor.unit.name eq 'CORE') {
- $all<CORE> //= $st;
- }
- if ($cursor.unit.bottom_ref || $cursor === $from_sub) {
- $all<SETTING> //= $st;
- }
- $cursor = $cursor.outer;
- }
- #say STDERR "UNIT ", $self->mainline;
- #$all->{'UNIT'} = $subt{$self->mainline};
- {
- my @nbits = @( $.mainline.find_pkg([$.name.split('::')]) );
- @nbits = $.ns.stash_canon(@nbits);
- # XXX wrong, but makes STD importing work
- # say STDERR (YAML::XS::Dump @nbits);
- $all<UNIT> = $all{join "", map { $_ ~ '::' }, @nbits};
- }
- # say STDERR (YAML::XS::Dump("Regenerated syml for " . $self->name, $all));
- $all;
- }
}
View
@@ -1,14 +0,0 @@
-class NAME is Hash {
- method new(*%foo) {
- my $new = Q:CgOp { (box (@ {NAME}) (varhash_new)) };
- unitem($new) = unitem(%foo);
- $new;
- }
-
- method name () { self.<name> }
- method xlex () { self.<xlex> }
- method olex () { self.<olex> }
- method of () { self.<of> }
- method file () { self.<file> }
- method line () { self.<line> }
-}
View
@@ -2990,7 +2990,7 @@ method package_def ($/) {
else {
my $obj = $*unit.deref($sub.body_of);
- if $*DECLARAND<stub> {
+ if $<stub> {
push $*unit.stubbed_stashes, ($obj => $/.CURSOR);
make mklex($/, $*CURLEX<!sub>.outervar);
@@ -3165,17 +3165,19 @@ method install_sub($/, $sub, :$multiness is copy, :$scope is copy, :$class,
$symbol ~= ":(!proto)" if $multiness eq 'proto';
} elsif $bindlex {
$symbol = '&' ~ $name;
+ $/.CURSOR.check_categorical($symbol);
if $multiness ne 'only' && !$sub.outer.lexicals.{$symbol} {
- $/.CURSOR.check_categorical($symbol);
$sub.outer.add_dispatcher($symbol, |mnode($/))
}
given $multiness {
when 'multi' { $symbol ~= ":({ self.gensym })"; }
when 'proto' { $symbol ~= ":(!proto)"; }
+ default {
+ $/.CURSOR.check_categorical($symbol);
+ }
}
} else {
- $/.CURSOR.check_categorical($symbol);
$symbol = self.gensym;
}
Oops, something went wrong.

0 comments on commit a94e021

Please sign in to comment.