root/misc/STD_red/README

Revision 20425, 3.1 kB (checked in by putter, 8 months ago)

[STD_red_run] Ruby 1.8 is no longer supported. Now checks for 1.9.
README: Added Debian install guidance.
STD_red_run: Load yaml.rb only if needed. Marked it depreciated in --help.
moritz_++

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1A ruby transliteration of src/perl6/STD.pm
2
3INSTALL
4
5The release of ruby 1.9.0 (dated late December '07) is recommended.
6It will not work with ruby 1.8.  ruby svn HEAD is also not the right thing.
7There used to be iffy support for 1.8, but adding utf handling broke it.
8
9http://www.ruby-lang.org/en/news/2007/12/25/ruby-1-9-0-released/
10$ ruby --version
11ruby 1.9.0 (2007-12-25 revision 14709) [...]
12
13Debian:
14 ruby1.9 libreadline-ruby1.9
15 * Debian (testing aka "Lenny") error:
16   `require': no such file to load -- readline (LoadError) from -e:1:in `<main>'
17   Means you don't have libreadline-ruby1.9.
18
19
20EXAMPLE
21  ./STD_red_run -e 42
22
23  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)
24  ~5 minutes
25
26NOTES
27
28STD_red_run is currently much faster in ruby 1.9 than 1.8.
29If you compile large things, you probably want to make sure its #! line finds 1.9.
30Either by having 1.9's "ruby" first in your PATH, or by editing the #! line.
31
32Regex reminders
33  given { <a>+ <b>+ }
34  token: /^ <a>+: <b>+: $/
35  rule:  /^ <.ws> <a>+: <.ws> <b>+: <.ws> $/
36  regex: /^ <a>+ <b>+ $/
37which transliterate as
38  token:  plusTOK{a} and plusTOK{b}
39  rule:   wsp and plusTOK{a} and wsp and plusTOK{b} and wsp  #handwritten rules
40  rule:           plusTOK{a} and wsp and plusTOK{b}          #in token rules #XXX hmm
41  regex:  plusRX(lambda{ a }){ plusRX{ b }}
42    # but note, <a> can't be a regex - we won't backtrack into it.
43
44There are lots of regex ruls.  Only the two noted as backtracking in
45comments actually do.
46
47Re backtracking,
48  plusRX et al, _do not backtrack into their subrules_.
49  We are simplifying implementation by noting there are tokens everywhere.
50  If there turns out to be a case of a regex with backtracking, containing
51  a subrule which is itself a regex with backtracking, then we'll need to
52  hand fudge passing a continuation to that subrule.  Very hopefully, the
53  case won't arise.
54  We're not making a regexp engine, nor a real Grammar.
55  We're simply trying to get the ability to parse static p6, by the
56  easiest possible development path.
57
58
59RUBY YAML
60
61Is not being used now, so you can ignore this section.
62
63--yaml won't work under ruby 1.9 without a patch applied to 1.9's yaml.rb.
64 *** But --yaml isn't being used now, so this is no longer needed.
65Error ruby/1.9.0/yaml.rb:391:in `hash': can't convert Hash into Integer (TypeError)
66ruby 1.9.0 yaml has a bug.  On some of Match objects, (eg, --yaml -e '3'),
67.hash fails with : can't convert Hash into Integer (TypeError).
68But 1.9's lookbehind provides 10x faster parsing than than our current 1.8 workaround.
69So here is a patch to lib/ruby/1.9.0/yaml.rb:
70PATCH_START
71--- yaml.rb.orig        2008-03-20 13:25:42.000000000 -0400
72+++ yaml.rb     2008-03-20 13:26:03.000000000 -0400
73@@ -386,6 +386,7 @@
74             end
75         oid =
76             case oid when Fixnum, NilClass; oid
77+            when Hash,Array; oid.object_id
78             else oid = "#{oid.object_id}-#{oid.hash}"
79             end
80         out.emit( oid, &e )
81PATCH_END
82
Note: See TracBrowser for help on using the browser.