{"id":18611798,"url":"https://github.com/compose-generator/ccom","last_synced_at":"2025-09-03T18:46:29.650Z","repository":{"id":36981588,"uuid":"361374721","full_name":"compose-generator/ccom","owner":"compose-generator","description":"⚙️ Compiler for the CCom (Conditional Comments) language","archived":false,"fork":false,"pushed_at":"2025-09-01T08:24:34.000Z","size":9396,"stargazers_count":4,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-01T10:45:32.269Z","etag":null,"topics":["comment","condition","cpp","grammar","interpreter","java","language"],"latest_commit_sha":null,"homepage":"https://ccom.compose-generator.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compose-generator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["marcauberer"],"custom":"https://www.paypal.me/marcauberer"}},"created_at":"2021-04-25T08:39:35.000Z","updated_at":"2024-12-25T22:32:38.000Z","dependencies_parsed_at":"2023-02-16T03:31:23.604Z","dependency_job_id":"61c3c402-3ff3-4582-aff6-74ecaf1d0042","html_url":"https://github.com/compose-generator/ccom","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/compose-generator/ccom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-generator%2Fccom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-generator%2Fccom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-generator%2Fccom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-generator%2Fccom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compose-generator","download_url":"https://codeload.github.com/compose-generator/ccom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-generator%2Fccom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273492624,"owners_count":25115598,"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-09-03T02:00:09.631Z","response_time":76,"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":["comment","condition","cpp","grammar","interpreter","java","language"],"created_at":"2024-11-07T03:14:53.301Z","updated_at":"2025-09-03T18:46:29.612Z","avatar_url":"https://github.com/compose-generator.png","language":"C++","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"CCom Logo\" src=\"./media/logo-wide.png\" height=\"280\" /\u003e\n  \u003ch3 align=\"center\"\u003eCCom language\u003c/h3\u003e\n  \u003cp align=\"center\"\u003eCompiler for the CCom (Conditional Comments) language.\u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca target=\"_blank\" href=\"https://github.com/compose-generator/ccom/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/compose-generator/ccom?include_prereleases\"\u003e\u003c/a\u003e\n    \u003ca target=\"_blank\" href=\"https://hub.docker.com/r/chillibits/ccom\"\u003e\u003cimg src=\"https://img.shields.io/docker/pulls/chillibits/ccom\"\u003e\u003c/a\u003e\n    \u003ca target=\"_blank\" href=\"https://github.com/compose-generator/ccom/actions/workflows/ci-go.yml\"\u003e\u003cimg src=\"https://github.com/compose-generator/ccom/actions/workflows/ci-go.yml/badge.svg\"\u003e\u003c/a\u003e\n\t\u003ca target=\"_blank\" href=\"https://github.com/compose-generator/ccom/actions/workflows/ci-cpp.yml\"\u003e\u003cimg src=\"https://github.com/compose-generator/ccom/actions/workflows/ci-cpp.yml/badge.svg\"\u003e\u003c/a\u003e\n\t\u003ca target=\"_blank\" href=\"https://github.com/compose-generator/ccom/actions/workflows/ci-java.yml\"\u003e\u003cimg src=\"https://github.com/compose-generator/ccom/actions/workflows/ci-java.yml/badge.svg\"\u003e\u003c/a\u003e    \n\t\u003ca target=\"_blank\" href=\"https://github.com/compose-generator/ccom/actions/workflows/codeql-analysis.yml\"\u003e\u003cimg src=\"https://github.com/compose-generator/ccom/actions/workflows/codeql-analysis.yml/badge.svg\"\u003e\u003c/a\u003e\n    \u003ca target=\"_blank\" href=\"https://goreportcard.com/report/github.com/compose-generator/ccom\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/compose-generator/ccom\"\u003e\u003c/a\u003e\n    \u003ca target=\"_blank\" href=\"https://makeapullrequest.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg\"\u003e\u003c/a\u003e\n    \u003ca target=\"_blank\" href=\"./LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/compose-generator/ccom\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n*Note: This language is part of the [Compose Generator](https://github.com/compose-generator/compose-generator) project, but also can be used independently.*\n\n## Introduction\nCCom is a language for pre-processing source files. It's primary purpose is to evaluate conditional sections in formats like YAML or XML, but can also be used for a variety of programming languages with support for comments.\n\n## Documentation\nPlease visit the documentation at [ccom.compose-generator.com](https://ccom.compose-generator.com).\n\n## Supported data formats\n|            | Line comment iden | Block comment iden open | Block comment iden close |\n|------------|-------------------|-------------------------|--------------------------|\n| Assembly   | ;                 | -                       | -                        |\n| C          | //                | /*                      | */                       |\n| C++        | //                | /*                      | */                       |\n| Dart       | //                | /*                      | */                       |\n| Dockerfile | #                 | -                       | -                        |\n| Elixir     | #                 | \"\"\"                     | \"\"\"                      |\n| Go         | //                | /*                      | */                       |\n| Groovy     | //                | /*                      | */                       |\n| Haskell    | --                | -{                      | -}                       |\n| HTML       | -                 | \u003c!--                    | --\u003e                      |\n| Java       | //                | /*                      | */                       |\n| JavaScript | //                | /*                      | */                       |\n| Julia      | #                 | #=                      | =#                       |\n| Kotlin     | //                | /*                      | */                       |\n| Lua        | --                | --[[                    | ]]                       |\n| Pascal     | -                 | (*                      | *)                       |\n| Perl       | #                 | =item                   | =cut                     |\n| PHP        | //                | /*                      | */                       |\n| Powershell | #                 | \u003c#                      | #\u003e                       |\n| Python     | #                 | \"\"\"                     | \"\"\"                      |\n| R          | #                 | -                       | -                        |\n| Ruby       | #                 | =begin                  | =end                     |\n| Rust       | //                | /*                      | */                       |\n| Spice      | //                | /*                      | */                       |\n| SQL        | --                | -                       | -                        |\n| Swift      | //                | /*                      | */                       |\n| TypeScript | //                | /*                      | */                       |\n| XML        | -                 | \u003c!--                    | --\u003e                      |\n| YAML       | #                 | -                       | -                        |\n\n*Note: Formats like JSON, where no comments are supported can also work with CCom, however then the file input is not valid before pre-processing it with CCom.*\n\n## Install\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eInstall on Debian / Ubuntu\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n```sh\n$ sudo apt-get install ca-certificates\n$ curl -fsSL https://server.chillibits.com/files/repo/gpg | sudo apt-key add -\n$ sudo add-apt-repository \"deb https://repo.chillibits.com/$(lsb_release -is | awk '{print tolower($0)}')-$(lsb_release -cs) $(lsb_release -cs) main\"\n$ sudo apt-get update\n$ sudo apt-get install ccom\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eInstall on Fedora\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n```sh\n$ sudo dnf -y install dnf-plugins-core\n$ sudo dnf config-manager --add-repo https://server.chillibits.com/files/repo/fedora.repo\n$ sudo dnf install ccom\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eInstall on CentOS\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n```sh\n$ sudo yum install -y yum-utils\n$ sudo yum-config-manager --add-repo https://server.chillibits.com/files/repo/centos.repo\n$ sudo yum install ccom\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eInstall on Raspbian\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n```sh\n$ sudo apt-get install ca-certificates\n$ curl -fsSL https://server.chillibits.com/files/repo/gpg | sudo apt-key add -\n$ sudo echo \"deb [arch=armhf] https://repo.chillibits.com/$(lsb_release -is | awk '{print tolower($0)}')-$(lsb_release -cs) $(lsb_release -cs) main\" \u003e /etc/apt/sources.list.d/chillibits.list\n$ sudo apt-get update\n$ sudo apt-get install ccom\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eInstall on Windows\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\nCCom gets distributed for Windows via the new Windows package manager called [winget](https://github.com/microsoft/winget-cli). In the future, winget will be available for download in the Microsoft Store. Currently, the easiest way to install winget is, to download it manually from GitHub. Visit the [installation instruction](https://github.com/microsoft/winget-cli#installing-the-client) from Microsoft. \u003cbr\u003e\nAs soon as the Windows package manager is installed on your Windows machine, you can open powershell and execute this installation command: \u003cbr\u003e\n```sh\n$ winget install ChilliBits.CCom\n```\n    \n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eUse with Docker\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n**Linux:**\n```sh\n$ docker run --rm -it -v $(pwd):/ccom/out chillibits/ccom\n```\n\n**Windows:**\n```sh\n$ docker run --rm -it -v ${pwd}:/ccom/out chillibits/ccom\n```\n*Note: This command does not work with Windows CMD command line. Please use Windows PowerShell instead.*\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n## Usage\nIn general, you call the cli like so: \u003cbr\u003e\n`ccom [options] \u003cinput\u003e`\n\n### CLI options\n| Option                                        | Shortcut         | Description                                                                           | Default |\n|-----------------------------------------------|------------------|---------------------------------------------------------------------------------------|---------|\n| `--benchmark \u003cnumber\u003e`                        | `-b \u003cno\u003e`        | Execute compiler benchmarks. n is the number of benchmark runs                        | 0       |\n| `--compiler \u003cname\u003e` (temporarily unavailable) | `-c \u003cname\u003e`      | Can be used to switch the compiler backend. Valid inputs are `cpp` and `java`         | \"cpp\"   |\n| `--data \u003cdata\u003e`                               | `-d \u003cdata\u003e`      | JSON string or path to JSON file, which holds the evaluation work data                | {}      |\n| `--lang \u003clang\u003e`                               | `-l \u003clang\u003e`      | File format / programming language (e.g. `yaml`, `java`, `html`, ...)                 | \"auto\"* |\n| `--mode-single`                               | `-m`             | Set input mode to single statement list                                               | -       |\n| `--out-file \u003cpath\u003e`                           | `-o \u003cpath\u003e`      | Path to output file. If you omit this flag, the output will be printed to the console | -       |\n| `--silent`                                    | `-s`             | Only print raw compiler output and no debug output                                    | -       |\n| `--force`                                     | `-f`             | Ignore safety checks. Warning: This could cause demage                                | -       |\n| `--line-comment-iden \u003cstring\u003e`                | `-lci \u003cstring\u003e`  | Specifies the line comment char(s) of your data format                                | \"#\"     |\n| `--block-comment-iden-open \u003cstring\u003e`          | `-bcio \u003cstring\u003e` | Specifies the opening block comment char(s) of your data format                       | \"\"      |\n| `--block-comment-iden-close \u003cstring\u003e`         | `-bcic \u003cstring\u003e` | Specifies the closing block comment char(s) of your data format                       | \"\"      |\n\n*) Lang \"auto\" determines the language based on the file extension of the input file.\n\n## Work process\nThe first thing CCom does, is to analyze the input and determine, whether it is a single condition or a source file. This depends on how you call the CCom CLI. To switch to a single statement, you can call it with the flag `--mode-single`\n\n### Source file mode\nCCom takes the whole file and feeds it into the interpreter, starting with the `CONTENT` grammar node.\n\nHere is an example YAML file, which can be evaluated by CCom:\n```yaml\n...\nproperty1: \"value1\"\n#? if has service.angular | has service.mysql {\n# property2:\n# \tproperty3: true\n#? }\n...\n```\n\nAnother example for Java with line comments (whatever you want to achieve with that)\n```java\npublic class Example {\n\tpublic static void main(String[] args) {\n\t\t//? if has property_name | has property\n\t\t//? {\n\t\t// if () {\n\t\t//    System.out.println(\"True\");\n\t\t// }\n\t\t//? }\n\t\t//? if not has property_name {\n\t\t// System.out.println(\"False\");\n\t\t//? }\n\t}\n}\n```\n\nAnother Java example with block comments:\n```java\npublic class Example {\n\tpublic static void main(String[] args) {\n\t\t/*? if has property_name {\n\t\t\tif () {\n\t\t\t\tSystem.out.println(\"True\");\n\t\t\t}\n\t\t}*/\n\t\t/*? if has property_name {\n\t\t\tif () {\n\t\t\t\tSystem.out.println(\"True\");\n\t\t\t}\n\t\t}*/\n\t}\n}\n```\n\n### Single condition mode (`--mode-single`)\nCCom feeds the condition into the interpreter, starting by the `STMT_LST` grammar node. The result is either `true` or `false`.\n\nHere is an example input: \u003cbr\u003e\n```ccom\nhas service.angular | has service.frontend[1] | has backend\n```\n\n### Data file\nCCom needs a JSON data tree to work with. To pass a file or a JSON string to CCOM, please use the `--data` flag. \u003cbr\u003e\nAn example file looks like this:\n```json\n{\n    \"version\": \"0.7.0\",\n    \"service\": {\n        \"frontend\": [\n            {\n                \"label\": \"Spring Maven\",\n                \"name\": \"spring-maven\",\n                \"dir\": \"./spring-maven\"\n            },\n            {\n                \"label\": \"Spring Gradle\",\n                \"preselected\": false\n            }\n        ],\n        \"backend\": []\n    },\n    \"var\": [\n        {\n            \"name\": \"SPRING_MAVEN_SOURCE_DIRECTORY\"\n        },\n        {\n            \"name\": \"SPRING_MAVEN_PACKAGE_NAME\",\n            \"value\": \"com.chillibits.test-app\"\n        }\n    ]\n}\n```\nTo access `0.7.0`, you can use the key `version`. To access `./spring-maven`, you can use the key `service.frontend[0].dir`.\n\n\n## Grammar\n*Note a grammar is dependent on the line comment identifiers and the block comment identifiers. In this particular case the line comment char is `//`, the block comment char open is `/*` and the block comment char close is `*/`*\n\nStart symbol: `CONTENT`.\n\n```\nCONTENT               --\u003e CHARS (SECTION CHARS)*\nSECTION               --\u003e COM_LINE_BLOCK | COM_BLOCK_BLOCK\nCOM_LINE_BLOCK        --\u003e COM_LINE_IDEN if STMT_LST COM_LINE_IDEN? { PAYLOAD COM_LINE_IDEN }\nCOM_BLOCK_BLOCK       --\u003e COM_BLOCK_IDEN_OPEN IF_BLOCK COM_BLOCK_IDEN_CLOSE\nIF_BLOCK              --\u003e if STMT_LST { PAYLOAD }\nCOM_LINE_IDEN         --\u003e //?\nCOM_IDEN_PAYLOAD      --\u003e //\nCOM_BLOCK_IDEN_OPEN   --\u003e /*?\nCOM_BLOCK_IDEN_CLOSE  --\u003e */\nPAYLOAD               --\u003e (COM_IDEN_PAYLOAD CHARS)+\nSTMT_LST              --\u003e STMT (`|` STMT)*\nSTMT                  --\u003e HAS_STMT | COMP_STMT | CONTAINS_STMT\nHAS_STMT              --\u003e not? has KEY\nCOMP_STMT             --\u003e KEY COMP_OP VALUE\nCONTAINS_STMT         --\u003e KEY not? contains KEY COMP_OP VALUE\nKEY                   --\u003e IDENTIFIER INDEX? (.IDENTIFIER INDEX?)*\nINDEX                 --\u003e [NUMBER]\nIDENTIFIER            --\u003e (Letter|UNDERSCORE) (LETTER* DIGIT* UNDERSCORE*)*\nVALUE                 --\u003e STRING | NUMBER | BOOLEAN\nSTRING                --\u003e \"CHARS_LIMITED\"\nNUMBER                --\u003e DIGIT+\nBOOLEAN               --\u003e true | false\nCOMP_OP               --\u003e == | != | \u003c | \u003e | \u003c= | \u003e=\nCHARS                 --\u003e ({UNICODE}\\{COM_LINE_IDEN, COM_BLOCK_IDEN_OPEN})*\nCHARS_LIMITED         --\u003e (LETTER* DIGIT* SCHAR* UNDERSCORE*)*\nLETTER                --\u003e a|b|...|y|z|A|B|...|Y|Z\nDIGIT                 --\u003e 0|1|2|3|4|5|6|7|8|9\nSCHAR                 --\u003e -|.|[|]|{|}|/|\\|'\nUNDERSCORE            --\u003e _\nUNICODE               --\u003e Any unicode character\n```\n\n## Keywords\n-   `if`\n-   `has`\n-   `not`\n-   `contains`\n\n## Special characters\n-   `?`\n-   `|`\n-   `.`\n-   `\"`\n-   `{` / `}`\n\n## AST Classes\n![Class diagram](media/class-diagram.svg \"Class diagram\")\n\n## Contribute to the project\nIf you want to contribute to this project, please ensure you comply with the [contribution guidelines](./CONTRIBUTING.md).\n\n© Marc Auberer 2021-2023\n","funding_links":["https://github.com/sponsors/marcauberer","https://www.paypal.me/marcauberer"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompose-generator%2Fccom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompose-generator%2Fccom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompose-generator%2Fccom/lists"}