{"id":16751758,"url":"https://github.com/jakoch/ometa-php","last_synced_at":"2025-04-10T15:52:05.473Z","repository":{"id":5434929,"uuid":"6627446","full_name":"jakoch/OMeta-PHP","owner":"jakoch","description":"OMeta: an Object-Oriented Language for Pattern Matching. PHP implementation of OMeta/JS.","archived":false,"fork":false,"pushed_at":"2021-02-09T18:27:38.000Z","size":286,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-24T13:37:26.158Z","etag":null,"topics":["grammars","ometa","parsing-expression-grammars","peg"],"latest_commit_sha":null,"homepage":"http://www.tinlizzie.org/ometa/","language":"PHP","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/jakoch.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2012-11-10T12:45:11.000Z","updated_at":"2021-02-09T18:27:42.000Z","dependencies_parsed_at":"2022-07-06T18:31:05.999Z","dependency_job_id":null,"html_url":"https://github.com/jakoch/OMeta-PHP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakoch%2FOMeta-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakoch%2FOMeta-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakoch%2FOMeta-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakoch%2FOMeta-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakoch","download_url":"https://codeload.github.com/jakoch/OMeta-PHP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248245311,"owners_count":21071457,"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","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":["grammars","ometa","parsing-expression-grammars","peg"],"created_at":"2024-10-13T02:44:49.119Z","updated_at":"2025-04-10T15:52:05.457Z","avatar_url":"https://github.com/jakoch.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"OMeta-PHP\n=========\n\nWork in progress: JS to PHP port\n\nBrief Overview\n--------------\n\nOMeta-PHP is an implementation of OMeta with PHP as the hosting language.\n\nOMeta is an object-oriented language for pattern-matching developed by Alessandro Warth and Ian Piumarta.\nIt is based on a variant of Parsing Expression Grammars (PEGs) which were extended to support matching on\narbitrary data types. OMeta's general-purpose pattern matching facilities provide a natural and convenient\nway for programmers to implement tokenizers, parsers, visitors, and tree transformers, all of which can be\nextended in interesting ways using familiar object-oriented mechanisms.\nThis makes OMeta particularly well-suited as a medium for experimenting with new designs\nfor programming languages and extensions to existing languages.\n\nPEG\n---\n\nParsing expression grammars (PEGs) are an alternative to context free grammars (CFGs) for formally\nspecifying syntax. PEGs are backtracking (unlimited lookahead) parsers with speculative parsing support.\nSpeculative Parsing is controled by syntactic predicates (grammar fragments),\nspecifying the lookahead and predicting an alternative.\nThe operator in the grammar is called \"prioritized choice\"-operator (|) - this rule \"OR\" that rule.\nTo avoid unneccessay reparsing partial parsing results are cached - this is called Memoizing.\nBryan Ford coined the term \"Packrat Parser\" for a \"memoizing recursive-descent parser\" in\nPackrat parsing: simple, powerful, lazy, linear time, functional pearl (http://bford.info/packrat/).\n\nA PEG is something like a Regular Expressions with recursion.\nPEGs operate on streams of characters.\nThe grammars are like templates with a parser combination description.\nBasically a PEG is a set of combinators.\nEach combinator is a function, which generates an atomic unit of a parser (called a rule).\nBy combining these parts (uhm, with combinators), you can generate complex parsers that\ncan handle a superset of Context Free Grammars.\nThe created parsers are data-structure agnostic. They can parse any input sequence.\nSo you might call the generated PHP parser a meta-language hosted in PHP.\n\nSummary\n------\n- OMeta-PHP is metalanguage.\n- You can create new language constructs, and create DSLs.\n- You can subclass existing parsers to extend a language.\n- You can invoke foreign rules, so you can subclass and \"derive\" from more than one parser class (composition of multiple grammars).\n\nLinks \u0026 Papers\n--------------\n1. Official OMeta/JS\n   - http://www.tinlizzie.org/~awarth/ometa/\n2. OMeta Mailinglist\n   - http://vpri.org/mailman/listinfo/ometa\n3. [WP07] Alessandro Warth and Ian Piumarta. OMeta: an Object-Oriented Language for Pattern Matching.\n   In DLS ’07: Proceedings of the 2007 symposium on Dynamic languages, pages 11–19, New York, NY, USA, 2007. ACM.\n   - http://www.cs.ucla.edu/~awarth/papers/dls07.pdf\n4. Alessandro Warth, Experimenting with Programming Languages, PhD dissertation, 2009,\n   - http://www.vpri.org/pdf/tr2008003_experimenting.pdf\n5. [For04] Bryan Ford. Parsing expression grammars: a recognition-based syntactic foundation.\n   In POPL ’04: Proceedings of the 31st ACM SIGPLAN-SIGACT symposium on Principles of programming languages,\n   pages 111–122, New York, NY, USA, 2004. ACM.\n   - http://www.brynosaurus.com/pub/lang/peg.pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakoch%2Fometa-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakoch%2Fometa-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakoch%2Fometa-php/lists"}