Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 430 Bytes

README.md

File metadata and controls

34 lines (26 loc) · 430 Bytes

Parslet sample

run sample

# clone this repo
% git clone [email protected]:pocari/parslet-calc-parser.git
% cd parslet-calc-parser

# install bundles
% bundle install --path=vendor/bundle

# show sample
% cat program.txt
def add(aaa, bbb)
  x = (1 + 2) * 3
  aaa + bbb + x
end

aaa = 1
bbb = 3
ccc = add((aaa + 2), bbb)

puts(aaa)
puts(bbb)
puts(ccc)

# run sampl
% bundle exec ruby main.rb < program.txt
1.0
3.0
15.0