Skip to content
Newer
Older
100644 87 lines (65 sloc) 2.59 KB
512f595 @zenspider Fixed and improved the readme
zenspider authored Nov 4, 2008
1 = ruby_parser
2
3 * http://parsetree.rubyforge.org/
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored Nov 14, 2007
4
5 == DESCRIPTION:
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored Dec 20, 2007
6
7 ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
8 racc--which does by default use a C extension). RP's output is
9 the same as ParseTree's output: s-expressions using ruby's arrays and
10 base types.
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored Nov 14, 2007
11
512f595 @zenspider Fixed and improved the readme
zenspider authored Nov 4, 2008
12 As an example:
13
14 def conditional1(arg1)
15 if arg1 == 0 then
16 return 1
17 end
18 return 0
19 end
20
21 becomes:
22
23 s(:defn, :conditional1,
24 s(:args, :arg1),
25 s(:scope,
26 s(:block,
27 s(:if,
28 s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))),
29 s(:return, s(:lit, 1)),
30 nil),
31 s(:return, s(:lit, 0)))))
32
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored Nov 14, 2007
33 == FEATURES/PROBLEMS:
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored Dec 20, 2007
34
35 * Pure ruby, no compiles.
af96092 @zenspider Refactored several smallish areas.
zenspider authored Feb 18, 2008
36 * Includes preceding comment data for defn/defs/class/module nodes!
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored Dec 20, 2007
37 * Incredibly simple interface.
38 * Output is 100% equivalent to ParseTree.
39 * Can utilize PT's SexpProcessor and UnifiedRuby for language processing.
512f595 @zenspider Fixed and improved the readme
zenspider authored Nov 4, 2008
40 * Known Issue: Speed is now pretty good, but can always improve:
41 * RP parses a corpus of 3702 files in 125s (avg 108 Kb/s)
42 * MRI+PT parsed the same in 67.38s (avg 200.89 Kb/s)
43 * Known Issue: Code is much better, but still has a long way to go.
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored Dec 20, 2007
44 * Known Issue: Totally awesome.
512f595 @zenspider Fixed and improved the readme
zenspider authored Nov 4, 2008
45 * Known Issue: line number values can be slightly off. Parsing LR sucks.
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored Nov 14, 2007
46
47 == SYNOPSIS:
48
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored Dec 20, 2007
49 RubyParser.new.parse "1+1"
50 # => s(:call, s(:lit, 1), :+, s(:array, s(:lit, 1)))
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored Nov 14, 2007
51
52 == REQUIREMENTS:
53
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored Dec 20, 2007
54 * ruby. woot.
512f595 @zenspider Fixed and improved the readme
zenspider authored Nov 4, 2008
55 * sexp_processor for Sexp and SexpProcessor classes.
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored Dec 20, 2007
56 * ParseTree for testing.
512f595 @zenspider Fixed and improved the readme
zenspider authored Nov 4, 2008
57 * racc full package for parser development (compiling .y to .rb).
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored Nov 14, 2007
58
59 == INSTALL:
60
2749468 @zenspider Removed ruby_parser.rb from manifest and worked into package rule ins…
zenspider authored Dec 20, 2007
61 * sudo gem install ruby_parser
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored Nov 14, 2007
62
63 == LICENSE:
64
65 (The MIT License)
66
512f595 @zenspider Fixed and improved the readme
zenspider authored Nov 4, 2008
67 Copyright (c) 2007-2008 Ryan Davis
afc6228 @zenspider MOSTLY DONE... importing now so I can track.
zenspider authored Nov 14, 2007
68
69 Permission is hereby granted, free of charge, to any person obtaining
70 a copy of this software and associated documentation files (the
71 'Software'), to deal in the Software without restriction, including
72 without limitation the rights to use, copy, modify, merge, publish,
73 distribute, sublicense, and/or sell copies of the Software, and to
74 permit persons to whom the Software is furnished to do so, subject to
75 the following conditions:
76
77 The above copyright notice and this permission notice shall be
78 included in all copies or substantial portions of the Software.
79
80 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
81 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
82 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
83 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
84 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
85 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
86 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.