{"id":16960141,"url":"https://github.com/dflemstr/tin","last_synced_at":"2025-03-17T08:37:39.297Z","repository":{"id":57668077,"uuid":"153739709","full_name":"dflemstr/tin","owner":"dflemstr","description":"A statically structurally typed JIT-compiled programming language, mainly for embedding in other programs.","archived":false,"fork":false,"pushed_at":"2019-08-18T15:49:49.000Z","size":485,"stargazers_count":64,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-13T06:36:44.872Z","etag":null,"topics":["embeddable","inference","jit","jit-compiler","language","rust","structural-typing"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/dflemstr.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":"2018-10-19T06:58:06.000Z","updated_at":"2025-02-07T10:31:51.000Z","dependencies_parsed_at":"2022-09-07T15:50:25.164Z","dependency_job_id":null,"html_url":"https://github.com/dflemstr/tin","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflemstr%2Ftin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflemstr%2Ftin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflemstr%2Ftin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflemstr%2Ftin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflemstr","download_url":"https://codeload.github.com/dflemstr/tin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852499,"owners_count":20358271,"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":["embeddable","inference","jit","jit-compiler","language","rust","structural-typing"],"created_at":"2024-10-13T22:47:15.236Z","updated_at":"2025-03-17T08:37:38.842Z","avatar_url":"https://github.com/dflemstr.png","language":"Rust","readme":"# `tin` [![CircleCI](https://circleci.com/gh/dflemstr/tin.svg?style=svg)](https://circleci.com/gh/dflemstr/tin) [![codecov](https://codecov.io/gh/dflemstr/tin/branch/master/graph/badge.svg)](https://codecov.io/gh/dflemstr/tin) [![docs](https://docs.rs/tin/badge.svg)](https://docs.rs/tin)\n\n`tin` is a new statically structurally typed programming language.  It's main purpose is to be embedded in other\nprograms (similar to e.g. Lua) but built to easily be compilable (initially JIT).\n\n`tin` is what you need to create the solder for your application.  It's easy to build plugin APIs that are type safe\nusing `tin`.\n\nDespite tin having the chemical symbol `Sn`, `tin` files conventionally use the `.tn` extension because it's easier to\nremember the mnemonic.\n\nCurrently, the language is a work in progress.  The MVP will be a Rust library and executable called `tin` that include\na JIT compiler and rudimentary type inference.\n\n[**Crate**](https://crates.io/crates/tin) | [**Documentation**](https://docs.rs/tin)\n\n## Example\n\n`tin` is purely expression oriented; there are no types per se.  In order to define a type, you give an example value\nfor the type.  This is very similar to prototype-based type systems, except there is no support for inheritance.\n\n```tin\n/* Defines the Int type by giving an example value */\nInt = 0i64;\n/* Similarly for String */\nString = \"\";\n\n/* A Person is anything that has both a name of type String and an age of type Int\n * The definintion is identical to: { name: \"\", age: 0i64 }\n */\nPerson = { name: String, age: Int };\n```\n\nEverything is either an expression or a variable definition.  There are for example no functions; there are only lambdas\nwhich can be assigned to variables:\n\n```tin\ngetAge = |person: Person| Int { person.age };\n```\n\n`tin` supports structural polymorphic type inference:\n\n```tin\ngetAge = |person| { person.age };\n\nmain = || {\n  getAge({age: 3}); /* → returns 3 */\n  getAge({age: \"Hello\"}); /* → returns \"Hello\" */\n  getAge({name: \"Hello\"}) /* compile time error */\n};\n```\n\n`tin` has several built-in types:\n\n```tin\n/* An unsigned 8-bit integer */\nExampleU8 = 0u8;\n/* An unsigned 16-bit integer */\nExampleU16 = 0u16;\n/* An unsigned 32-bit integer */\nExampleU32 = 0u32;\n/* An unsigned 64-bit integer */\nExampleU64 = 0u64;\n\n/* A signed 8-bit integer */\nExampleI8 = 0i8;\n/* A signed 16-bit integer */\nExampleI16 = 0i16;\n/* A signed 32-bit integer */\nExampleI32 = 0i32;\n/* A signed 64-bit integer */\nExampleI64 = 0i64;\n\n/* A 32 bit floating point number */\nExampleF32 = 0.0f32;\n/* A 64 bit floating point number */\nExampleF64 = 0.0f64;\n\n/* An UTF-8 string */\nExampleString = \"\";\n\n/* A symbol value */\nExampleSymbol = :foo;\n\n/* A tuple */\nExampleTuple = (String, I8, I8);\n/* A record */\nExampleRecord = { name: String, x: I8, y: I8 };\n\n/* A lambda */\nExampleLambda = |tuple: ExampleTuple, record: ExampleRecord, int: I8| I8 { int };\n```\n","funding_links":[],"categories":["Other"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflemstr%2Ftin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflemstr%2Ftin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflemstr%2Ftin/lists"}