[t/spec] Add tricky tests (which pass after latest Rakudo patch), unfudge old simple...
[pugs.git] / misc / STD_red / README
blobf1ab47636aa90b8547560c5fb5cd0f25d2411a17
1 A ruby transliteration of an old src/perl6/STD.pm
3 INSTALL
5 (1) Obtain ruby version 1.9 or later.
6 (2) Make it available in your PATH as "ruby1.9",
7     or edit the #! line of STD_red_run.
9 Quick test:
10   ./STD_red_run -e 42
12 Checking ruby version:
13  $ ruby1.9 --version
14  ruby 1.9.0 (2007-12-25 revision 14709) [...]
15  $ ruby --version
17 Debian/Ubuntu install:
18  As of June 2010,
19  $ sudo apt-get ruby1.9
20  For direct interactive use (not needed for elf), also
21  $ sudo apt-get libreadline-ruby1.9
23 Fedora install:
24  As of June 2010,
25  Several years after debian got 1.9, fedora still doesn't have it.
26  You'll have to build it yourself.
27  After installing ruby 1.9 somewhere, create a ruby1.9 alias:
28  # ln -s ruby ruby1.9
31 ======================================================================
32 The rest of this file is quite old, and of little interest.
35 EXAMPLE
36   ./STD_red_run -e 42
38   time ((find ../../v6/v6-KindaPerl6/t/kp6/ -type f ; find ../../t/ -type f )| grep -v '\.svn' | sort | xargs -n 1 perl -e 'local $_=shift;exit if !/\.t$/;$r=system("./STD_red_run $_ > /dev/null 2>&1");print "",($r == 0 ? "-" : "X")," ",$_,"\n";' > test-status)
39   ~5 minutes
41 NOTES
43 Debian (testing aka "Lenny") error:
44  `require': no such file to load -- readline (LoadError) from -e:1:in `<main>'
45  Means you don't have libreadline-ruby1.9.
46  But readline is now only loaded if you run the repl.
48 Regex reminders
49   given { <a>+ <b>+ }
50   token: /^ <a>+: <b>+: $/
51   rule:  /^ <.ws> <a>+: <.ws> <b>+: <.ws> $/
52   regex: /^ <a>+ <b>+ $/
53 which transliterate as
54   token:  plusTOK{a} and plusTOK{b}
55   rule:   wsp and plusTOK{a} and wsp and plusTOK{b} and wsp  #handwritten rules
56   rule:           plusTOK{a} and wsp and plusTOK{b}          #in token rules #XXX hmm
57   regex:  plusRX(lambda{ a }){ plusRX{ b }}
58     # but note, <a> can't be a regex - we won't backtrack into it.
60 There are lots of regex ruls.  Only the two noted as backtracking in
61 comments actually do.
63 Re backtracking,
64   plusRX et al, _do not backtrack into their subrules_.
65   We are simplifying implementation by noting there are tokens everywhere.
66   If there turns out to be a case of a regex with backtracking, containing
67   a subrule which is itself a regex with backtracking, then we'll need to
68   hand fudge passing a continuation to that subrule.  Very hopefully, the
69   case won't arise.
70   We're not making a regexp engine, nor a real Grammar.
71   We're simply trying to get the ability to parse static p6, by the
72   easiest possible development path.
75 RUBY YAML
77 Is not being used now, so you can ignore this section.
79 --yaml won't work under ruby 1.9 without a patch applied to 1.9's yaml.rb.
80  *** But --yaml isn't being used now, so this is no longer needed.
81 Error ruby/1.9.0/yaml.rb:391:in `hash': can't convert Hash into Integer (TypeError)
82 ruby 1.9.0 yaml has a bug.  On some of Match objects, (eg, --yaml -e '3'),
83 .hash fails with : can't convert Hash into Integer (TypeError).
84 But 1.9's lookbehind provides 10x faster parsing than than our current 1.8 workaround.
85 So here is a patch to lib/ruby/1.9.0/yaml.rb:
86 PATCH_START
87 --- yaml.rb.orig        2008-03-20 13:25:42.000000000 -0400
88 +++ yaml.rb     2008-03-20 13:26:03.000000000 -0400
89 @@ -386,6 +386,7 @@
90              end
91          oid =
92              case oid when Fixnum, NilClass; oid
93 +            when Hash,Array; oid.object_id
94              else oid = "#{oid.object_id}-#{oid.hash}"
95              end
96          out.emit( oid, &e )
97 PATCH_END