{"id":26679609,"url":"https://github.com/maxrt101/xcc","last_synced_at":"2025-03-26T06:16:44.622Z","repository":{"id":271427075,"uuid":"874805123","full_name":"maxrt101/xcc","owner":"maxrt101","description":"XCC Programming language compiler based on LLVM","archived":false,"fork":false,"pushed_at":"2025-03-25T00:07:07.000Z","size":92,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T00:19:58.142Z","etag":null,"topics":["compiler","cpp17","llvm","programming-language"],"latest_commit_sha":null,"homepage":"","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/maxrt101.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}},"created_at":"2024-10-18T13:47:37.000Z","updated_at":"2025-03-25T00:09:14.000Z","dependencies_parsed_at":"2025-01-07T18:02:52.874Z","dependency_job_id":"00fc617a-d874-414b-b325-5370ab69088e","html_url":"https://github.com/maxrt101/xcc","commit_stats":null,"previous_names":["maxrt101/xcc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Fxcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Fxcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Fxcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Fxcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxrt101","download_url":"https://codeload.github.com/maxrt101/xcc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245598314,"owners_count":20641884,"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":["compiler","cpp17","llvm","programming-language"],"created_at":"2025-03-26T06:16:44.135Z","updated_at":"2025-03-26T06:16:44.615Z","avatar_url":"https://github.com/maxrt101.png","language":"C++","readme":"# XCC - Programming Language\n\nA strongly-typed compiled programming language with Rust/C inspired syntax.  \nUses LLVM as a backend because of its vast support of platforms, JIT, and other features.  \nXCC is a working name, it may be changed later.  \nCC - is taken from GCC (GNU Compiler Collection), while XCC is not a compiler collection,  \nit most certainly is a compiler. X - is just a cool letter that I like :)  \n\n### How to run  \nPrerequisites:  \n - GCC/clang  \n - CMake  \n - LLVM installed (and findable through CMake)\n\nBuild:  \n - `cmake -B build -S .`  \n - `cd build`  \n - `make` (if makefile generator is used, you can use ninja, or anything else that CMake supports)  \n\nRun:  \n - `./build/xcc` - for a REPL (JIT powered interpreter)  \n - `./build/xcc FILE` - to run a file  \n\n### Features  \n - Functions (user-defined, extern, forward-declarations)  \n - Variables (local \u0026 global)  \n - Number literals (in 8, 10, 16 bases + float point)  \n - String literals (ascii only, null-terminator automatically appended + escape sequences)  \n - Character literals (ascii only)\n - Basic data types (`i8`, `i16`, `i32`, `i64`, `u8`, `u16`, `u32`, `u64`, `void`)  \n - Arithmetic operations (`+`, `-`, `*`, `/`)  \n - Comparison operations (`==`, `!=`, `\u003c`, `\u003c=`, `\u003e`, `\u003e=`)  \n - Pointers (dereferencing `*`, taking address of a variable `\u0026`)  \n - Subscripting (`[]`, no array type, so only usable on pointers)  \n - Variadic functions (only declarations, no API to actually use it by the user)  \n - Strings (null-terminated, as `i8*`)  \n - String interning  \n - Conditional execution (`if` statement, works just like in C)  \n - Loops (only `for` is supported (syntax like in C), `while` is in the works)  \n - Type casts (to some extent, represented by `as` expression)  \n - User-defined types (`struct` \u0026 member access operator `.` + pointer member access `-\u003e`)  \n - JIT (which allows for REPL to exist)  \n - Runtime function resolution in the scope of running process using extern  \n\n### Syntax  \nHere's a hello world program:  \n```\nextern fn printf(fmt: i8*, ...): i32;\n\nfn main(): i32 {\n  printf(\"Hello, World!\\n\");\n  return 0;\n}\n```\n\nHere's a more complex program showing a bit more features:  \n```\nextern fn printf(fmt: i8*, ...): i32;\nextern fn malloc(size: u32): u8*;\nextern fn free(ptr: u8*): void;\nextern fn strlen(ptr: u8*): u32;\n\nstruct buffer_t {\n  data: i8*;\n  size: u32;\n}\n\nstruct context_t {\n  status: u32;\n  buf: buffer_t;\n}\n\nfn memcopy(dest: i8*, src: i8*, size: u32): u32 {\n  for (var i: u32 = 0; i \u003c size; i = i + 1) {\n    dest[i] = src[i];\n  }\n  return 0;\n}\n\nfn context_init(ctx: context_t*, str: i8*): void {\n  ctx-\u003ebuf.size = strlen(str) + 1;\n  ctx-\u003ebuf.data = malloc(ctx-\u003ebuf.size);\n\n  memcopy(ctx-\u003ebuf.data, str, ctx-\u003ebuf.size);\n\n  ctx-\u003estatus = 1;\n}\n\nfn context_deinit(ctx: context_t *): void {\n  if (ctx-\u003ebuf.data != 0) {\n    free(ctx-\u003ebuf.data);\n  }\n}\n\nfn main(): i32 {\n  var s: context_t;\n\n  s.status = 0;\n\n  context_init(\u0026s, \"Hello, World!\");\n\n  if (s.status == 1) {\n    printf(\"%d %p '%s'\\n\", s.buf.size, s.buf.data, s.buf.data);\n  } else {\n    printf(\"Context is in an invalid state!\\n\");\n  }\n\n  context_deinit(\u0026s);\n\n  return 0;\n}\n```\n\n### REPL  \nWhen running XCC executable without argument - you will be dropped into the REPL.  \nREPL is a Read Eval Print Loop. You can type in statements and they will be executed.  \nREPL has some special commands, such as `/help`, `/quit` \u0026 `list`.  \n`/help` or `/h` - shows help message.  \n`/quit` or `/q` - exists the REPL.  \n`/list` or `/l` - lists declared global functions.  \nIn REPL compiler behaves a bit differently, for example `;` is not required at the end  \nof the statement, otherwise everything else should work normally.  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxrt101%2Fxcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxrt101%2Fxcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxrt101%2Fxcc/lists"}