Skip to content

Instantly share code, notes, and snippets.

@shelling
Created July 17, 2014 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shelling/925575d7ba7ffd225a11 to your computer and use it in GitHub Desktop.
Save shelling/925575d7ba7ffd225a11 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "parslet"
require "pp"
class SimpleParser < Parslet::Parser
rule :top do
integer
end
rule :integer do
match('[0-9]').repeat(1)
end
root :top
end
pp SimpleParser.new.parse("123")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment