{"id":19297249,"url":"https://github.com/lawrancej/CompilerKit","last_synced_at":"2025-04-22T08:31:26.056Z","repository":{"id":3328134,"uuid":"4371640","full_name":"lawrancej/CompilerKit","owner":"lawrancej","description":"Compiler construction library in C.","archived":false,"fork":false,"pushed_at":"2012-10-26T16:20:39.000Z","size":1258,"stargazers_count":54,"open_issues_count":41,"forks_count":33,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-09T23:02:25.946Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lawrancej.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-18T17:19:28.000Z","updated_at":"2024-10-18T02:52:11.000Z","dependencies_parsed_at":"2022-08-26T22:50:36.460Z","dependency_job_id":null,"html_url":"https://github.com/lawrancej/CompilerKit","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/lawrancej%2FCompilerKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrancej%2FCompilerKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrancej%2FCompilerKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawrancej%2FCompilerKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lawrancej","download_url":"https://codeload.github.com/lawrancej/CompilerKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250206184,"owners_count":21392205,"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":[],"created_at":"2024-11-09T23:01:49.327Z","updated_at":"2025-04-22T08:31:21.843Z","avatar_url":"https://github.com/lawrancej.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"CompilerKit\n===========\nCompilerKit will be a [parser combinator](#what-is-a-parser-combinator) based compiler construction library in C.\n\n- [How can I contribute to this?](#how-can-i-contribute-to-this)\n- [What is the license?](#what-is-the-license)\n- [Why does this exist?](#why-does-this-library-exist)\n- [What problems does this solve?](#what-problems-does-this-library-solve)\n- [How will this library work?](#how-will-this-work)\n\n## How can I contribute to this?\nRead [how to hack on CompilerKit.](HACKING.md)\n\n## What is the license?\nLGPL version 2.1 or later.\n\n## Why does this library exist?\nCompilerKit aims to streamline developing any software deriving tree structures from text, including compilers and interpreters.\nThis library will be the final product of a compiler design class.\n\nThis library aims to [avoid problems in existing tools](#what-problems-does-this-library-solve) by doing these:\n\n- Work across platforms, programming languages.\n- Play nicely with Unicode.\n- Never block, and be thread-safe.\n- Efficiently handle all possible CFGs, even ambiguous ones.\n- Work as a library.\n- (Future) be a drop in replacement for Bison, yacc, lex, etc.\n\n## What problems does this library solve?\nMany existing compiler construction tools:\n\n- Require learning a new syntax (e.g., lex, yacc, Bison)\n- Add complexity to the build process (e.g., lex, yacc, Bison)\n- Do not handle all possible context free grammars (e.g., lex, yacc)\n- Work with only one language (e.g., lex, yacc)\n- Produce blocking code (e.g., lex)\n- Produce non thread-safe code (e.g., lex)\n- Do not work well with Unicode or non-string sequences.\n\n## What is a [parser combinator?](http://en.wikipedia.org/wiki/Parser_combinator)\nA parser combinator is a higher-order function that creates parsers from parsers.\n\nSimilar libraries:\n\n- [Boost Spirit (C++)](http://boost-spirit.com/home/)\n- [Parsec (Haskell)](http://www.haskell.org/haskellwiki/Parsec)\n\nProposed example usage:\n\n    Nonterminal * value = nonterminal (\"value\");\n    Nonterminal * product = nonterminal (\"product\");\n    Nonterminal * sum = nonterminal (\"sum\");\n    Nonterminal * expr = nonterminal (\"expr\");\n    Parser * formula = derivative_parser (expr);\n    \n    /*\n     Define the grammar below:\n     value -\u003e [0-9]+ | (expr)\n     product -\u003e value ((*|/) value)*\n     sum -\u003e product ((+|-) product)*\n     expr -\u003e sum\n     */\n    value-\u003ebecomes (many1(digit()));\n    value-\u003ebecomes (parens(expr));\n    product-\u003ebecomes (value, many (or(symbol('*'),symbol('/')), value));\n    sum-\u003ebecomes (product, many (or(symbol('+'), symbol('-')), product));\n    expr-\u003ebecomes (sum);\n    \n    /* Return whether the formula parser matched the expression \"(1+2+3+4)/2\". Should return true */\n    formula-\u003ematch(\"(1+2+3+4)/2\");\n    \n    /* Free the parser. */\n    parser_free (formula);\n\n## How will this work?\nThis library will use GObject internally.\n\nWe will employ test-first pair programming in the development of CompilerKit. (By the way, if you have a better name for this, I'm all ears.)\n\nTesting and documentation first ensures that we consider the usage of this library before we develop it. It also helps track development progress by test completion and coverage.\n\nPair programming ensures that we learn from each other.\n\nThe library will consist of the following components:\n\n- [Regular expression engine](#what-is-the-regular-expression-engine)\n- [Scanner](#what-is-the-scanner-component)\n- [Parser](#what-is-the-parser-component)\n- [Language bindings](#what-are-the-language-bindings)\n\n### What is the regular expression engine?\nThe regular expression engine will be swappable:\n\n- NFA backend\n- DFA backend\n- Derivative backend\n- PCRE backend\n\n### What is the scanner component?\nThe scanner requires a regular expression engine to work.\n\n### What is the parser component?\nThe parser construction will be separate from the swappable parsing backends:\n\n- Recursive descent parser.\n- [Derivative based parser](http://matt.might.net/articles/parsing-with-derivatives/).\n- GLR parser, if time permits.\n\n### What are the language bindings?\nLanguage bindings will make use of GObject introspection. This library will target support for:\n\n- C#\n- Python\n- C++\n- Java\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawrancej%2FCompilerKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flawrancej%2FCompilerKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawrancej%2FCompilerKit/lists"}