ARST

Abstract Ruby Syntax Tree (ARST) is a high-level language syntax denoting the object domain of a Ruby project.

ARST can be used to generate:

  • Pure Ruby
  • C Ruby extensions
  • Test::Unit, MiniTest::Unit, MiniTest::Spec, or RSpec tests
  • GraphViz graphs
  • Custom output

ARST files can also be generated from existing projects which allows:

  • Bootstrapping C Ruby extensions
  • Bootstrapping Test::Unit, MiniTest::Unit, MiniTest::Spec, or RSpec tests
  • Generating GraphViz graphs

Integrations:

Generators:

Install

Bundler: gem 'arst' in group :development

RubyGems: gem install arst

Syntax

Ruby

ARST syntax implements most keywords and declarations of the Ruby language's syntax.

This means that most syntax highlighters for Ruby will also work for ARST.

Valid Ruby syntax within ARST:

  • module ModuleName
  • class ClassName < SuperClassName
  • include ModuleName
  • extend ModuleName
  • def instance_method(arg1, *other_args) (and anything else accepted method arguments in Ruby's syntax)
  • def self.class_method(arg1, opts={}) (and anything else accepted method arguments in Ruby's syntax)

Indentation

ARST is an indentation-sensitive syntax meaning that the following are not equivalent:

module Foo
  module Bar

module Foo
module Bar

When interpreting the ARST syntax, the parser accepts any number of identical sequential whitespace characters at the starst of a line as an "indentation step".
Valid whitespace characters are the space () and tab (\t) characters.

Once the first indentation step is found while parsing, all subsequent indentation steps must contain the same amount of whitespace characters as the first step:

Valid

module Foo
  module Bar
    module Baz

Invalid

module Foo
  module Bar
         module Baz

Usage

Copyright © 2013 Ryan Scott Lewis [email protected].

The MIT License (MIT) - See LICENSE for further details.