{"id":27867616,"url":"https://github.com/eteran/quixey","last_synced_at":"2025-05-04T22:50:51.371Z","repository":{"id":31363324,"uuid":"34926233","full_name":"eteran/quixey","owner":"eteran","description":"A small C like scripting language with a few small novel features.","archived":false,"fork":false,"pushed_at":"2016-10-06T22:10:36.000Z","size":97,"stargazers_count":27,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-05-01T13:39:00.976Z","etag":null,"topics":["scripting-language"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eteran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-01T22:06:26.000Z","updated_at":"2023-05-16T18:09:30.000Z","dependencies_parsed_at":"2022-08-24T13:10:39.399Z","dependency_job_id":null,"html_url":"https://github.com/eteran/quixey","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/eteran%2Fquixey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eteran%2Fquixey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eteran%2Fquixey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eteran%2Fquixey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eteran","download_url":"https://codeload.github.com/eteran/quixey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252411808,"owners_count":21743604,"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":["scripting-language"],"created_at":"2025-05-04T22:50:50.506Z","updated_at":"2025-05-04T22:50:51.366Z","avatar_url":"https://github.com/eteran.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nQuixey\n======\n\nQuixey is a C-ish scripting language where I toy around with a few ideas that I\nhave found interesting over the years. It inherits a many things from C, such \nas the scoping rules, most operators, and general curly brace syntax. However, \nunlike C, it has a native `string` type, ranged `for`, lambdas, an `auto` type, \nand much more.\n\nI don't intend for this language to be taken particularly seriously, but it \nwas fun to develop.\n\nAn interesting property of the implementation of the `auto` keyword is that\nsince it is defined as assuming the type of the first assignment to it, is \nthat it can have a different type in different scopes... But it can never \nchange types in a given scope. For example:\n\n\tauto foo(int x) {\n\t\tif(x) {\n\t\t\treturn \"Hello\";\n\t\t} else {\n\t\t\treturn 42;\n\t\t}\n\t}\n\t\n\t// since this function returns the auto type, we must capture the result\n\t// in an auto type as well. \n\tauto n1 = foo(1); // n1 == \"Hello\" and is of type string\n\tauto n2 = foo(0); // n2 == 42 and is of type int\n\t\n\t// Now we can use is_integer and is_string to decide what to do with the \n\t// values as needed.\n\t\nAditionally, for similar reasons, the following is perfectly legal:\n\n    auto n;\n\tif(func()) {\n\t\tn = \"A String!\";\n\t} else {\n\t\tn = 123;\n\t}\n\t\n\t// at this point n is one of the two possible types depending on the result\n\t// of func()\n\t\nOf course for \"poor mans templates\", you can use `auto` for function parameters \nas well.\n\n    auto func(auto n) {\n\t\t// do something with n depending on the type!\n\t}\n\t\nHowever, you cannot change the type once it is set. So unlike weakly typed \nlanguages. **The following is not allowed in quixey**.\n\n    auto x = 1;\n\tx = 'A'; // ERROR: cannot change type!\n\t\n\n## Supported Escape Sequences:\n* `\\'`    : Single quote\n* `\\\"`    : Double quote\n* `\\\\`    : Backslash\n* `\\a`    : Audible bell\n* `\\b`    : Backspace\n* `\\f`    : Formfeed\n* `\\n`    : Newline\n* `\\r`    : Carriage return\n* `\\t`    : Horizontal tab\n* `\\v`    : Vertical tab\n* `\\xnnn` : Hexadecimal number (nnn)\n* `\\nnn`  :  number (nnn)\n\n**NOTE**: in octal and hex decimal escape sequences, there is no limit on the number\n          of digits but the least significant digits will be used (as happens in gcc).\n          So for example `'\\x12345678'` is functionally the same as `'\\x78'`\n\n## Supported Operators:\n\n* `/=`  : divide left by right and assign to left\n* `/`   : divide left by right\n* `\u0026=`  : binary AND left and right and assign to left\n* `\u0026\u0026`  : logical AND left and right\n* `\u0026`   : binary AND left and right\n* `|=`  : binary OR left and right and assign to left\n* `||`  : logical OR left and right\n* `|`   : binary OR left and right\n* `^=`  : XOR left and right and assign to left\n* `^`   : XOR left and right\n* `~`   : compliment unary operand\n* `==`  : test if left equals right\n* `=`   : assign right to left\n* `!=`  : test if left does not equal right\n* `!`   : logical NOT of unary operand\n* `+=`  : add left and right and assign to left\n* `+`   : add left and right\n* `-=`  : subtract right from left and assign to left\n* `-`   : subtract right from left\n* `*=`  : multiply left and right and assign to left\n* `*`   : multiply left and right\n* `%=`  : modulo divide left by right and assign to left\n* `%`   : modulo divide left by right\n* `\u003e\u003e=` : right shift left by right and assign to left\n* `\u003e\u003e`  : right shift left by right\n* `\u003e=`  : test if left is greater than or equal to right\n* `\u003e`   : test if left is greater than right\n* `\u003c\u003c=` : left shift left by right and assign to left\n* `\u003c\u003c`  : left shift left by right\n* `\u003c=`  : test if left is less than or equal to right\n* `\u003c`   : test if left is less than right\n\n## Supported Types:\n\n* `char`\n* `int`\n* `string`\n* `auto` (assumes the type of the first thing assigned to it)\n\n**NOTE**: modifiers such as unsigned are not supported\n\n## Supported Keywords:\n\n**NOTE**: unlike C/C++ keywords like `if`, `else`, `for`, `do`, `while` **require** the \n          curly braces, they are not optional\n\n`if`, `else`:\n\n\tif(x) { }\n\tif(x) { } else { }\n\tif(x) { } else if(y) { }\n\tif(x) { } else if(y) { } else { }\n\n`for`:\n\n**NOTE**: you may declare a variable in the initialization part of the\n          for loop, this variable only exists inside the loop. Just like in C++.\n\n**NOTE**: the for each style syntax requires that you declare a variable as the\n          initializer.\n\n\tfor(i = 0; i \u003c 10; i += 1) { }\n\tfor(int i = 0; i \u003c 10; i += 1) { }\n\tfor(auto e : a) {}\n\n`do`:\n\n    do { } while(x);\n\t\n`while`:\n\n    while(x) { }\n\t\n`return`:\n\n**NOTE**: Every function has a return type. If the end of a function is reached with no return, then an implicit\n          `return 0;` is executed at function exit.\n\t\n`int`, `char`, `string`. `auto`\n\n\tint x = 5;\n\tchar y;\n\tstring s = \"hello\";\n\tchar ch = s[3];\n\tauto a1 = \"hello\";\n\tauto a2 = 5;\n\tauto a3 = 'C';\n\tauto a4 = a2;\n\n## Arrays\n\nArrays are heterogeneous, and are created via array literals so far:\n\n    auto x = ['a', 'b', 'c', 1234, \"HELLO\", [1, 2, 3, 4], function() { printf(\"W00t!\\n\"); }];\n\t\nSee `test4.qc` for some advanced usage of them such as type deduction.\n\n## Lambdas\n\nlamdas are supported, and can only be assigned to a variable of type `auto`:\n\t\n\tauto f = function() {\n\t\tputs(\"hello world\");\n\t};\n\t\n\tf(); // prints \"hello world\"\n\nlambdas also, always have the return type of `auto`.\n\n\n## Built-in Functions\n* `int size(auto x); // returns the length of an array or string`\n* `int puts(string s); // just like C's puts`\n* `int getch(); // gets 1 character from stdin`\n* `int getnum(); // gets an integer from stdin`\n* `int putchar(char ch); // puts a character to stdout`\n* `int is_integer(auto x); // returns non-zero if the parameter is an integer`\n* `int is_character(auto x); // returns non-zero if the parameter is a character`\n* `int is_string(auto x); // returns non-zero if the parameter is a string`\n* `int is_function(auto x); // returns non-zero if the parameter is an function or lambda`\n* `int is_array(auto x); // returns non-zero if the parameter is an array`\n* `int printf(string s, ...); // just like C's printf, an experiement in supporting variadic functions (may not stick around)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feteran%2Fquixey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feteran%2Fquixey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feteran%2Fquixey/lists"}