{"id":28429672,"url":"https://github.com/mobskuchen/vault","last_synced_at":"2025-07-23T04:02:38.892Z","repository":{"id":295309693,"uuid":"989764060","full_name":"MOBSkuchen/vault","owner":"MOBSkuchen","description":"Verified, Atomic, Uncomplicated, Low-level Toolkit","archived":false,"fork":false,"pushed_at":"2025-05-29T18:28:18.000Z","size":184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-05T13:48:07.326Z","etag":null,"topics":["llvm-frontend","programming-language"],"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/MOBSkuchen.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-24T19:24:00.000Z","updated_at":"2025-05-29T18:23:22.000Z","dependencies_parsed_at":"2025-05-24T20:34:02.748Z","dependency_job_id":"e215f1d9-7083-4c1e-b265-065b6afbeaf7","html_url":"https://github.com/MOBSkuchen/vault","commit_stats":null,"previous_names":["mobskuchen/vault"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MOBSkuchen/vault","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOBSkuchen%2Fvault","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOBSkuchen%2Fvault/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOBSkuchen%2Fvault/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOBSkuchen%2Fvault/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MOBSkuchen","download_url":"https://codeload.github.com/MOBSkuchen/vault/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOBSkuchen%2Fvault/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266614306,"owners_count":23956341,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["llvm-frontend","programming-language"],"created_at":"2025-06-05T13:38:46.395Z","updated_at":"2025-07-23T04:02:38.818Z","avatar_url":"https://github.com/MOBSkuchen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VAULT\nStands for Verified, Atomic, Uncomplicated, Low-level Toolkit\n\nand is a C-like, Rust-inspired and written optimized low level programming language\n\n## Does the world really need this? Another C?\nWell kind of. C is at its core a way to write low level code, without fiddling with registers.\nStupid as we programmers are, we have taken it to all kinds of places it was not made for - everything which is not a computer in the 70s or a bare metal machine. I think, that what makes C great, is the control it gives over the hardware and its *do what you want approach*. Its flaws are obvious tho: No namespaces, no easy way of obtaining packages and other libraries, and most importantly: **no compiler, that is made for humans**.\n\nVAULT aims to change that. (currently most of it is not yet implemented lol). It features LLVMs amazing optimizations, C's control and the rust compilers *smartness*.\n\n### Why not yet another C compiler?\nCreating a C-spec adherent compiler that fulfills those desires is impossible. Due to the nature of the language, anything past some better error handling is impossible.\n\nThat's why I changed the things that needed changing and along the way also made some sensible improvements, because this language does not yet need to be backwards compatible 50 years.\n\n### VAULT's philosophy\nThe programmer knows what they are doing. Give them the right tools and they can achieve greatness.\n\n## Installation\nCurrently, the only way of obtaining the compiler is by cloning the repo and building it. This also means building LLVM on your machine.\n\nNotice: Make sure to compile LLVM in release mode and also compile this project in release mode (or debug if that's what you want).\n\n## The Syntax\nFirst program: *Print \"Hello World\"*\n````\nimport stdlib\n\ndef export main(): void {\n    stdlib::print(\"Hello World\")\n}\n````\n### Types\nVAULT has the following types\n- **i32**: 32-bit signed   integer\n- **i64**: 64-bit signed   integer\n- **u32**: 32-bit unsigned integer\n- **u64**: 64-bit unsigned integer\n- **u8**:  8-bit  unsigned integer\n- **f32**: 32-bit          float\n- **f64**: 64-bit          float\n- **bool**: 1-bit unsigned integer\n- **void**: Function type exclusive void\n- **struct**: A struct. Not actually a type, but you create your own types via structs\n- **function**: A type representing a function\n\n### Assignments\nAssignment are similar to the ones in rust. However, types must always be clear. Mutability is by default and there is no const.\n```\n// Automatically infer a name\nlet name = \"John\";\n// Annotated type\nlet last_name: u8* = \"Doe\";\n// Declaration (must include a type)\nlet age: i32;\n// Reassignment\nage = 23;\nname = \"Chuck\";\n```\n\n### Functions def / dec\nFunction definitions and declarations are similar to Python and C.\n\nFunction modes:\n- export : Expose externally\n- extern : Declared externally\n- private : WIP\n- *default* : WIP (public)\n\nNote : The *main* function is not mandatory and can return anything, e.g. **unchecked**\n```\n// Return type i32\ndef export main(): i32 {\n    return 0\n}\n\n// Extern void function with param 'num' i32\ndef extern print_whatever(num: i32): void;\n```\n\n### Function calling\nCalling a function is very simple and identical to many other languages.\n\nNote: *void*-type functions can not be used as values. That will result in a compiler error\n\n```\n// `age`, `print_user_data` and `prompt_for_name` previously defined\n\nlet name = prompt_for_name(\"What's your name? \");\nprint_user_data(age, name);\n```\n\n### Malloc and free\nMalloc and free are built in and have their own syntax.\nBoth will return the type `ptr` which is an untyped pointer. You might want to cast it or use type annotations.\n\nNote: Free can be auto-detected for most things\n```\n// Allocate 256 bytes\nlet result: u8* = |\u003e 256;\n// Scanf to `result`\nstdlib::ptr_input(result, 256);\n```\n\nUse `|\u003e (amount)` for malloc and `|\u003c (expr)` for free\n\n### Structs\nStruct definitions are a like the ones in rust, but simpler.\n\n```\nstruct Point {\n    x: i32,\n    y: i32\n}\n```\n\n#### Initialization\nUse the `new` keyword to create a struct. The arguments must be in the order that the struct has.\n\n```\n// x = 0; y = 1\nlet point = new Point(0, 1);\n```\n\nTo reassign a property, you must have a pointer to the property (like shown before)\n```\n\u0026point~x = 160;\n```\n\n#### Properties\nLiteral and pointer access are possible. However, they must occur on a pointer to the struct.\n\n```\n// Access literal value of `Point-\u003ex`\nlet x: i32 = \u0026point.x;\n// Access pointer to value of `Point-\u003ex`\nlet x: i32* = \u0026point~x;\n```\n\nTo reassign a property, you must have a pointer to the property (like shown before)\n```\n\u0026point~x = 160;\n```\n\n#### Member functions on structs\nDeclaring member functions for structs is also possible:\n```\ndef draw_point(p: Point*) Point : void {\n    ...\n}\n```\nFirst param of the method must be of type *struct* pointer.\n\nThey are called like so:\n```\n// The value to call on must be a pointer to the struct\n\u0026point.draw_point();\n```\n\n### Conditionals\nIf-*elif*-else statements are possible and a combination of C and python syntax.\n```\nlet error_code = do_something_dangerous();\n\nif error_code != 0 {\n    stdlib::print(\"An error has occured!\")\n} else {\n    stdlib::print(\"Everything is fine\")\n};\n// Note: ';' is required after the last block\n```\n\n### Conditional loops\nWhile statements are possible and a combination of C and python syntax.\n```\nlet a = 100;\nwhile a \u003e 10 {\n    a = a - 1;\n};\n// Note: ';' is required after the block\n```\n\n### Casts\nYou may cast all primitive types (all types except structs and functions).\nHowever, you must be careful as casts are **NOT** safe and purely change the *perceived type*.\n```\n// Ext cast.\nlet num: i32 = 0;\nlet other = num =\u003e i64;\n// Trunc cast. (lossy)\nnum = other =\u003e i32;\n...\n// Very useful: Cast a typed pointer into an untyped one\nlet p = \"abc\" =\u003e ptr;\n```\n\n### Imports\nYou may import code from other files.\nOnce you import a file (aka module), you carry over all symbols to the MAV (Module Access Variant) named after the module. Import compiles the file in between the previous and following code.\n```\n// Import the file 'stdlib.vt' to 'stdlib'\nimport stdlib\n...\n// Import the file 'stdlib.vt' to 'std'\nimport stdlib =\u003e std\n...\n// Import the file 'stdlib-other.vt' to 'std'\nimport \"stdlib-other\" =\u003e std\n...\n// Invalid syntax! String imports require a module name\nimport \"stdlib-other\"\n```\n\nThen use as follows:\n```\nstd::imported_function(\"this is neat\");\n```\n\n### Directives\nDirectives are compile time instructions. They may enable you to link something for specific users or enable / disable creating a function.\n```\n// Windows only function\n#(OS \"windows\")\ndef func();\n```\nDirectives are declared with `#`. They follow the layout `( NAME \u003c...\u003e )`. They always return a boolean.\nPutting them over a statement will disable / enable it depending on the return value of the directive.\n\nHere is a list of directives:\n- AND \u003ca: directive\u003e \u003cb: directive\u003e\n- OR \u003ca: directive\u003e \u003cb: directive\u003e\n- XOR \u003ca: directive\u003e \u003cb: directive\u003e\n- NOT \u003ca: directive\u003e\n- ALWAYS =\u003e Always returns *true*\n- NEVER =\u003e Always returns *false*\n- DEBUG =\u003e Returns whether debug mode is on\n- LINK \u003cpath: string\u003e =\u003e Link with a library; Always returns *true*\n- OS \u003cos: string\u003e =\u003e Is on os\n- ARCH \u003carch: string\u003e =\u003e Is on arch\n- IF \u003ccondition: directive\u003e \u003cexe: directive\u003e =\u003e Runs and returns value of exe if condition is true\n- IFI \u003ccondition: directive\u003e \u003cexe: directive\u003e =\u003e Runs exe if condition is true; Always returns *true*\n- IFE \u003ccondition: directive\u003e \u003celse: directive\u003e \u003cexe: directive\u003e =\u003e Runs exe if condition is true, otherwise else; Returns the corresponding value\n- IFEI \u003ccondition: directive\u003e \u003celse: directive\u003e \u003cexe: directive\u003e =\u003e Runs exe if condition is true, otherwise else; Always returns *true*\n- ERR \u003cfooter: string\u003e =\u003e Creates a compiler error at the directive with a footer\n- ERRN \u003cfooter: string\u003e \u003cnote: string\u003e =\u003e Creates a compiler error at the directive with a footer and a note\n- WARN \u003cfooter: string\u003e =\u003e Creates a compiler warning at the directive with a footer; Always returns *true*\n- WARNF \u003cfooter: string\u003e =\u003e Creates a compiler warning at the directive with footer; Always returns *false*\n\n## Concepts\n### 1. (Built-in) free means destruction\nWhen using the built-in free method, the compiler will forget about the variable to protect against *use after free* exceptions\n### 2. Data types should match their memory layout\nThere are no built-in arrays or hashmaps or such, because they abstract how data is stored in memory and how the CPU handles it","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobskuchen%2Fvault","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobskuchen%2Fvault","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobskuchen%2Fvault/lists"}