| 1 | # ruby_parser translation |
| 2 | |
| 3 | Prism ships with the ability to translate its syntax tree into the syntax tree used by the [seattlerb/ruby_parser](https://github.com/seattlerb/ruby_parser) gem. This allows you to use tools built on top of the `ruby_parser` gem with the `prism` parser. |
| 4 | |
| 5 | ## Usage |
| 6 | |
| 7 | You can call the `parse` and `parse_file` methods on the `Prism::Translation::RubyParser` module: |
| 8 | |
| 9 | ```ruby |
| 10 | filepath = "path/to/file.rb" |
| 11 | Prism::Translation::RubyParser.parse_file(filepath) |
| 12 | ``` |
| 13 | |
| 14 | This will return to you `Sexp` objects that mirror the result of calling `RubyParser` methods, as in: |
| 15 | |
| 16 | ```ruby |
| 17 | filepath = "path/to/file.rb" |
| 18 | RubyParser.new.parse(File.read(filepath), filepath) |
| 19 | ``` |