public
Description: A Ruby-based parsing DSL based on parsing expression grammars.
Homepage: http://treetop.rubyforge.org
Clone URL: git://github.com/nathansobo/treetop.git
treetop / script / generate_metagrammar.rb
100644 14 lines (11 sloc) 0.484 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env ruby
 
require 'rubygems'
dir = File.dirname(__FILE__)
require File.join(dir, '..', 'lib', 'treetop', 'bootstrap_gen_1_metagrammar')
 
GENERATED_METAGRAMMAR_PATH = File.join(TREETOP_ROOT, 'compiler', 'metagrammar.rb')
 
File.open(METAGRAMMAR_PATH) do |source_file|
  File.open(GENERATED_METAGRAMMAR_PATH, 'w') do |target_file|
    generated_source = Treetop::Compiler::MetagrammarParser.new.parse(source_file.read).compile
    target_file.write(generated_source)
  end
end