{"id":17925033,"url":"https://github.com/zerowidth/tire_swing","last_synced_at":"2025-08-29T16:08:09.235Z","repository":{"id":410720,"uuid":"29893","full_name":"zerowidth/tire_swing","owner":"zerowidth","description":"Simple node and visitor definitions for Treetop grammars","archived":false,"fork":false,"pushed_at":"2008-12-06T02:03:37.000Z","size":180,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T20:13:00.138Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/aniero/treehouse","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerowidth.png","metadata":{"files":{"readme":"README.txt","changelog":"History.txt","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-06-30T05:04:07.000Z","updated_at":"2019-08-13T13:27:59.000Z","dependencies_parsed_at":"2022-07-04T15:12:00.986Z","dependency_job_id":null,"html_url":"https://github.com/zerowidth/tire_swing","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zerowidth/tire_swing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Ftire_swing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Ftire_swing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Ftire_swing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Ftire_swing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerowidth","download_url":"https://codeload.github.com/zerowidth/tire_swing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Ftire_swing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272717027,"owners_count":24981481,"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-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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-28T20:52:02.986Z","updated_at":"2025-08-29T16:08:09.127Z","avatar_url":"https://github.com/zerowidth.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"TireSwing\n    by Nathan Witmer\n    http://github.com/aniero/tire_swing\n\n== DESCRIPTION:\n\nSimple node and visitor definitions for Treetop grammars.\n\n== FEATURES/PROBLEMS:\n\n* Simple node definition syntax for defining an AST\n* Simple visitor definition to walk an AST\n\n== SYNOPSIS:\n\nGiven a treetop grammar:\n\n  grammar SimpleAssignment\n    rule assignment\n      lhs:variable space* \"=\" space* rhs:variable \u003cnode(:assignment)\u003e\n    end\n    rule variable\n      [a-z]+ \u003cnode(:variable)\u003e\n    end\n    rule space\n      [ ]+\n    end\n  end\n\nYou can use TireSwing to define nodes for the grammar:\n\n  module SimpleAssignment\n    include TireSwing::NodeDefinition\n\n    node :assignment, :lhs, :rhs\n    node :variable, :value =\u003e :text_value\n  end\n\nAnd use TireSwing to extend the Treetop-provided parser with a helper method or two:\n\n  TireSwing.parses_grammar(SimpleAssignment)\n\nWhen you parse the grammar using the helper, it will return an AST using the nodes you defined, auto-building everything\nfor you:\n\n  ast = SimpleAssignment.ast(\"foo = bar\")\n\n  ast.class #=\u003e SimpleAssignment::Assignment\n  ast.lhs.class #=\u003e SimpleAssignment::Variable\n  ast.lhs.value #=\u003e \"foo\"\n\nYou can also define visitors for an AST:\n\n  module SimpleAssignment\n    include TireSwing::VisitorDefinition\n\n    visitor :hash_visitor do\n      visits Assignment do |a|\n        hash = {}\n        hash[ visit(lhs) ] = visit(rhs)\n        hash\n      end\n      visits Variable do |v|\n        v.value\n      end\n    end\n  end\n\n  SimpleAssignment::HashVisitor.visit(ast) #=\u003e {\"foo\" =\u003e \"bar\"}\n\n  See examples/simple_assignment.rb for the full code.\n\n== REQUIREMENTS:\n\n* treetop\n* attributes\n* active_support\n\n== INSTALL:\n\n* sudo gem install aniero-tire_swing -s http://gems.github.com\n\n== LICENSE:\n\n(The MIT License)\n\nCopyright (c) 2008 Nathan Witmer\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerowidth%2Ftire_swing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerowidth%2Ftire_swing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerowidth%2Ftire_swing/lists"}