Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

23 lines (18 sloc) 0.415 kB
require 'semr'
language = Semr::Language.create do
concept :number, any_number, :normalize => as_fixnum
concept :greeting, words('hi', 'goodbye', 'hello')
phrase 'say :greeting :number times' do |greeting, number|
number.times { puts greeting }
end
end
language.parse('say hello 6 times')
# hello
# hello
# hello
# hello
# hello
# hello
language.parse('say goodbye 2 times')
# goodbye
# goodbye
Jump to Line
Something went wrong with that request. Please try again.