{"id":16666330,"url":"https://github.com/thomas-crane/pine","last_synced_at":"2026-05-27T18:31:30.002Z","repository":{"id":90545895,"uuid":"161235942","full_name":"thomas-crane/pine","owner":"thomas-crane","description":"A general purpose, type checked language inspired by Rust.","archived":false,"fork":false,"pushed_at":"2018-12-25T00:39:50.000Z","size":59,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-12T21:36:45.236Z","etag":null,"topics":["compile-to-js","compiler","programming-language","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/thomas-crane.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","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,"publiccode":null,"codemeta":null}},"created_at":"2018-12-10T21:02:34.000Z","updated_at":"2023-01-27T23:21:06.000Z","dependencies_parsed_at":"2023-07-18T11:00:45.732Z","dependency_job_id":null,"html_url":"https://github.com/thomas-crane/pine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thomas-crane/pine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-crane%2Fpine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-crane%2Fpine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-crane%2Fpine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-crane%2Fpine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomas-crane","download_url":"https://codeload.github.com/thomas-crane/pine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-crane%2Fpine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33579665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"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":["compile-to-js","compiler","programming-language","typescript"],"created_at":"2024-10-12T11:10:36.718Z","updated_at":"2026-05-27T18:31:29.985Z","avatar_url":"https://github.com/thomas-crane.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pine\n\n[![Build Status](https://travis-ci.org/thomas-crane/pine.svg?branch=master)](https://travis-ci.org/thomas-crane/pine)\n\nPine is a general purpose, type checked language which is heavily inspired by Rust.\nPine compiles to Node.js style JavaScript.\n\n## Contents\n\n+ [Foreword](#foreword)\n+ [Install](#install)\n  + [From GitHub](#from-github)\n+ [The CLI](#the-cli)\n  + [`print \u003cfilename\u003e`](#print-filename)\n  + [`compile \u003cfilename\u003e`](#compile-filename)\n+ [Syntax and examples](#syntax-and-examples)\n  + [Variables and if statements](#variables-and-if-statements)\n  + [Functions](#functions)\n  + [Custom types](#custom-types)\n+ [Building](#building)\n+ [Testing and contributing](#testing-and-contributing)\n\n## Foreword\n\nThis project is still in early development. Many features may be buggy or not yet implemented.\n\n## Install\n\n### From GitHub\n\n```bash\ngit clone https://github.com/thomas-crane/pine.git\ncd pine\nnpm link\n```\n\n## The CLI\n\nThere are several CLI commands available which can be used to compile and inspect Pine code.\n\nThe current supported arguments are\n\n### `print \u003cfilename\u003e`\n\nPrints the AST representation of the Pine code in the given file.\n\n### `compile \u003cfilename\u003e`\n\nCompiles the given Pine file to JavaScript. **This is not yet implemented.**\n\n## Syntax and examples\n\nThese examples are also available in the `examples/` directory.\nA full description of the [grammar in EBNF form](/docs/grammar.ebnf) is available in the `docs/` directory.\n\n### Variables and if statements\n\n```pine\nnum x = 20;\nstr test;\n\nif x \u003e 15 {\n  test = 'x \u003e 15';\n} else if x \u003c 10 {\n  test = 'x \u003c 10';\n} else {\n  test = '15 \u003e x \u003e 10';\n}\n```\n\nIf statements can also be used as expressions, so the following code is equivalent\n\n```pine\nstr test = if x \u003e 15 {\n  'x \u003e 15'\n} else if x \u003c 10 {\n  'x \u003c 10'\n} else {\n  '15 \u003e x \u003e 15'\n}\n```\n\n### Functions\n\n```pine\nfn fib(num n) -\u003e num {\n  if n \u003c= 1 {\n    1\n  } else {\n    fib(n - 1) + fib(n - 2)\n  }\n}\n\nfib(10);\n```\n\n### Custom types\n\n```pine\n# A type which represents a coordinate on a grid.\ntype Point\n  | num x\n  | num y\n  ;\n\n# Methods which are available on Point type.\ntype Point has {\n\n  # Static method.\n  fn new(num x, num y) -\u003e Point {\n    Point {\n      x = x,\n      y = y,\n    }\n  }\n\n  # Instance method.\n  fn scale(self, num factor) -\u003e Point {\n    Point::new(self:x * factor, self:y * factor)\n  }\n}\n```\n\n## Building\n\nIf you want to create a custom fork of the Pine compiler, you will need to rebuild the project when you make changes. The `package.json` has 3 scripts which are used for building.\n\n+ `npm run clean` - deletes the build directory (`dist/`)\n+ `npm run compile` - compiles the TypeScript.\n+ `npm run build` - Runs `clean`, then `compile`.\n\nMost of the time, `build` is the script that you want to run. If it is your first time building however, `compile` will be a bit faster.\n\n## Testing and contributing\n\nIf you wish to contribute to the Pine compiler, feel free to create a pull request. When contributing, it is important to contribute tested code. To run existing tests, use the command\n\n```bash\nnpm test\n```\n\nThis will run the unit tests located in the `test/` dir.\n\nWhen adding a feature, make sure the new feature has tests. Even if some of them do not pass.\n\nThere is an additional npm command which can be run to ensure your code follows the project's style guidelines.\n\n```bash\nnpm run lint\n```\n\nThis command runs tslint. You should make sure this passes, as pull requests that do not pass this command will be rejected.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-crane%2Fpine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomas-crane%2Fpine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-crane%2Fpine/lists"}