Sha256: bed1f199ce47af503e7b039dbf38d9726784bf4c99f9bf5bd1872e56efe06b31

Contents?: true

Size: 312 Bytes

Versions: 3

Compression:

Stored size: 312 Bytes

Contents

# frozen_string_literal: true

module Basic101

  class Parser < Parslet::Parser

    root(:program)

    rule(:program) do
      ((line >> (new_line >> line).repeat(0) >> new_line.maybe).maybe).as(:program)
    end

    rule(:line) do
      (integer >> space? >> statements.as(:statements))
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
basic101-1.0.2 lib/basic101/parser/program.rb
basic101-1.0.1 lib/basic101/parser/program.rb
basic101-1.0.0 lib/basic101/parser/program.rb