Created
July 17, 2014 04:06
-
-
Save shelling/925575d7ba7ffd225a11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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