Skip to content

Rubinius' melbourne parser extracted into a gem (without the actual Rubinius) - create ASTs for arbitrary Ruby code

License

Notifications You must be signed in to change notification settings

carlosbrando/melbourne

Repository files navigation

Melbourne

Melbourne is Rubinius' parser component. The +melbourne+ gem extracts this parser component for stand-alone use under MRI and other environments.

For Melbourne's full RDoc, see rdoc.info.

Usage

Melbourne generates abstract syntax trees (ASTs) from Ruby source code:

require 'melbourne'

'class Test; end'.to_ast # => <AST::Class:0x1017800f8
                                @line=1,
                                @body=#<AST::EmptyBody:0x101780058 @line=1>,
                                @name=#<AST::ClassName:0x101780080 @line=1, @superclass=#<AST::Nil:0x1017800a8 @line=1>, @name=:Test>,
                                @superclass=#<AST::Nil:0x1017800a8 @line=1>>

Abstract Syntax Trees

Abstract syntax trees allow for deep introspection of Ruby source code and are far easier to handle than e.g. S-expressions as provided by ParseTree and other gems.

For more information on abstract syntax trees, see Wikipedia.

Authors

The original code of Melbourne is part of the Rubinius project and was written by and is © Evan Phoenix.

Melbourne was extracted from Rubinius into this gem by Marco Otte-Witte.

Bugs/ Feature Requests

the +melbourne+ gem is not maintained by the Rubinius team! If you encounter bugs or have feature requests, refer to the Github repository.

About

Rubinius' melbourne parser extracted into a gem (without the actual Rubinius) - create ASTs for arbitrary Ruby code

Resources

License

Stars

Watchers

Forks

Packages

No packages published