summaryrefslogtreecommitdiff
path: root/tool/parse.rb
blob: 93ae3e43cb2083319cf6de62a4ca7172ce14090f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Used as part of the "make parse" Makefile target.
# See common.mk for details.

$file = ARGV[0]
$str  = ARGF.read.sub(/^__END__.*\z/m, '')
puts '# ' + '-' * 70
puts "# target program: "
puts '# ' + '-' * 70
puts $str
puts '# ' + '-' * 70

$parsed = RubyVM::InstructionSequence.compile_file($file)
puts "# disasm result: "
puts '# ' + '-' * 70
puts $parsed.disasm
puts '# ' + '-' * 70