{"id":16406472,"url":"https://github.com/wincent/walrat","last_synced_at":"2025-08-12T14:45:53.697Z","repository":{"id":1025030,"uuid":"853019","full_name":"wincent/walrat","owner":"wincent","description":"Ruby packrat parser generator","archived":false,"fork":false,"pushed_at":"2025-01-24T10:07:22.000Z","size":146,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T22:51:09.120Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://wincent.dev/products/walrat","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wincent.png","metadata":{"files":{"readme":"README.txt","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-08-21T11:12:55.000Z","updated_at":"2024-03-28T22:09:56.000Z","dependencies_parsed_at":"2025-02-11T21:42:01.057Z","dependency_job_id":null,"html_url":"https://github.com/wincent/walrat","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wincent/walrat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fwalrat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fwalrat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fwalrat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fwalrat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wincent","download_url":"https://codeload.github.com/wincent/walrat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fwalrat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266303658,"owners_count":23908373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T06:09:53.319Z","updated_at":"2025-07-21T12:39:40.029Z","avatar_url":"https://github.com/wincent.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Walrat =\n\nWalrat is a Parsing Expression Grammar (PEG) parser generator, written in Ruby,\nthat produces \"packrat\" (memoizing) parsers capable of lexing, parsing and\nbuilding arbitrarily complex Abstract Syntax Trees (ASTs).\n\nWalrat was originally written in 2007 as part of the Walrus object-oriented\ntemplating system. In 2010 it was extracted into a separate gem for easier\nreuse in other projects. The Walrus grammar is an excellent example of some of\nthe more advanced parsing techniques that can be achieved using Walrat,\nincluding:\n\n* dynamic parser generation at runtime via a simple DSL\n* standard PEG constructs such as ordered choice, concatenation, repetition\nand predicates\n* string and regular-expression based \"parslets\"\n* arbitrarily complex proc/lambda based \"parslets\"\n* convenient and customizable inter-token skipping behavior (whitespace\nskipping)\n* left-recursion\n* left-associative and right associative productions\n* dynamic AST node synthesis\n* addition of custom behavior to AST nodes (such as compilation behavior)\nthrough custom Ruby code\n* multiline comments, including nested multiline comments\n* \"island\" parsers for processing \"here\" documents and include files\n\n\n== Example ==\n\n    require 'rubygems'\n    require 'walrat'\n    \n    class MySuperGrammar \u003c Walrat::Grammar\n      starting_symbol :sequence\n      skipping        :whitespace\n      rule            :whitespace, /\\s+/\n      rule            :sequence, :digits \u0026 (',' \u0026 :digits).zero_or_more\n      rule            :digits, /\\d+/\n    end\n    \n    grammar = MySuperGrammar.new\n    \n    begin\n      grammar.parse 'hello!'\n    rescue Walrat::ParseError =\u003e e\n      puts \"bad input: failed to parse (#{e})\"\n    end\n    \n    result = grammar.parse '123, 456, 789'\n    puts \"good input: parsed (#{result})\"\n\nRunning this file produces the following output:\n\n    bad input: failed to parse (non-matching characters \"hello!\" while parsing regular expression \"/\\A(?-mix:\\d+)/\")\n    good input: parsed (123,456,789)\n\n\n== System requirements ==\n\nThe original release of Walrat (0.1) only supported Ruby 1.8, although it could\nwork to some degree on other versions.\n\nFrom the 0.2 release on, Ruby 2.1 is required.\n\nJRuby is not yet officially supported, although many complex grammars (such as\nthe Walrus grammar) have already been successfully tested.\n\n\n== Installation ==\n\n    sudo gem install walrat\n\n\n== Development ==\n\n    $ git clone git://git.wincent.dev/walrat.git\n    $ cd walrat\n    $ bundle install --binstubs\n    $ bin/spec spec\n\n\n== Website ==\n\nThe official Git repository can be browsed at:\n\n  https://github.com/wincent/walrat\n\n\n== Author ==\n\nWalrat is written and maintained by Greg Hurrell \u003cgreg@hurrell.net\u003e.\n\n\n== License ==\n\nCopyright 2007-2014 Greg Hurrell. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice,\n   this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwincent%2Fwalrat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwincent%2Fwalrat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwincent%2Fwalrat/lists"}