{"id":13782715,"url":"https://github.com/sebbekarlsson/cola","last_synced_at":"2025-03-25T20:41:27.375Z","repository":{"id":81577839,"uuid":"157251624","full_name":"sebbekarlsson/cola","owner":"sebbekarlsson","description":"component language (component-based programming language)","archived":false,"fork":false,"pushed_at":"2019-02-05T11:27:57.000Z","size":265,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T18:04:37.244Z","etag":null,"topics":["components","interpreter","programming-language","wip"],"latest_commit_sha":null,"homepage":null,"language":"C","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/sebbekarlsson.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-11-12T17:36:16.000Z","updated_at":"2022-07-22T14:31:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7ca1e66-bbb7-45d5-96a9-d6f1b76a3750","html_url":"https://github.com/sebbekarlsson/cola","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/sebbekarlsson%2Fcola","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebbekarlsson%2Fcola/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebbekarlsson%2Fcola/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebbekarlsson%2Fcola/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sebbekarlsson","download_url":"https://codeload.github.com/sebbekarlsson/cola/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245542061,"owners_count":20632422,"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":["components","interpreter","programming-language","wip"],"created_at":"2024-08-03T18:01:42.484Z","updated_at":"2025-03-25T20:41:27.340Z","avatar_url":"https://github.com/sebbekarlsson.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"\u003cdiv style='width: 100%;' align='center'\u003e\u003cimg src='cola.svg.png'/\u003e\u003c/div\u003e\n\n## Cola\n\u003e _A component-based programming language._\n\n## Snippet\n\u003e Here is what it looks like:\n\n    comp productlist use httplib, json {\n        function array\u003cmap\u003e get_products {\n            return json.parse(httplib.get('http://example.org/products'));\n        };\n\n        function array\u003cmap\u003e yields {\n            return get_products();    \n        };\n    };\n\n\n    comp main use productlist {\n        function void run {\n            foreach (productlist as product) {\n                print(product);    \n            };\n        };\n    };\n\n## How to write a component\n### The syntax\n\u003e The syntax for a component looks like this:  \n`comp [NAME] use [DEPENDENCY-LIST] [LBRACE] [RBRACE]`  \n\n    comp mycomponent use somelibrary {\n        ...    \n    };\n\n### The run-method\n\u003e The `run` method in a component can be executed through the `run` statement:\n\n    comp mycomponent {\n        function void run {\n            print(\"Hello World!\")    \n        };\n    };\n\n    comp main use mycomponent {\n        // run method of `mycomponent` is executed when mounted like this\n    };\n\n### The yields-method\n\u003e The `yields` method in a component is used to make a component act as if\n\u003e it was another data-type. For example:\n\n    comp PI {\n        function float yields {\n            return 3.14;\n        };    \n    };\n\n    comp main use PI {\n        function void run {\n            print(PI * 0.5);    \n        };    \n    };\n\n\u003e ... here, the `PI` component is treated as if it was a float.\n\n### Interpreter instructions\n\u003e You can include other files using interpreter instructions, it looks\n\u003e very much like in `C`:\n\n    #include \"somefile.cola\"\n\n\n    comp main {\n        ...\n\n## Data-types\n\u003e The existing data-types are:  \n* int\n* string\n* array\n* map\n* struct\n\n### Note\n\u003e The `array` data-type can hold any sort of type, but the type must\n\u003e be specified like: `array\u003cint\u003e numbers;` or `array\u003cstring\u003e names;`\n\n\u003e The `map` data-type can also hold any sort of type and specified like:  \n\u003e `map\u003cstr, int\u003e ages;` or `map\u003cstring, array\u003cint\u003e\u003e fav_numbers;`\n\n## Built-in methods\n\u003e These are the built-in methods that currently exists:\n* **print** - _print something to stdout_ (takes an infinite list of arguments)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebbekarlsson%2Fcola","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebbekarlsson%2Fcola","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebbekarlsson%2Fcola/lists"}