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