{"id":20599364,"url":"https://github.com/xomadev/sketch","last_synced_at":"2025-04-15T00:40:55.310Z","repository":{"id":106270897,"uuid":"544780224","full_name":"XomaDev/sketch","owner":"XomaDev","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-15T09:58:35.000Z","size":1021,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T12:38:52.934Z","etag":null,"topics":["interpreter","java"],"latest_commit_sha":null,"homepage":"","language":"Java","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/XomaDev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-03T08:00:31.000Z","updated_at":"2022-12-03T13:08:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"701c66a6-55d6-46b5-bb4b-cc8d578bcf34","html_url":"https://github.com/XomaDev/sketch","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/XomaDev%2Fsketch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XomaDev%2Fsketch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XomaDev%2Fsketch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XomaDev%2Fsketch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XomaDev","download_url":"https://codeload.github.com/XomaDev/sketch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986270,"owners_count":21194024,"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":["interpreter","java"],"created_at":"2024-11-16T08:32:43.222Z","updated_at":"2025-04-15T00:40:55.304Z","avatar_url":"https://github.com/XomaDev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sketch\n\n![sketch](/asset/sketch.png)\n\nSketch is a language intended for fun.\n\u003cbr\u003e\nIt has a Kotlin-style syntax.\n\u003cbr\u003e\n\nSketch uses an AST-type parser to evaluate code.\n\n````kotlin\nval date = 07;\nval goodboy = true;\n\nfun today() {\n  if (  goodboy ) {  print(\"apologize!\");  }\n  else {    delay();    };\n};\n\nfun delay() {\n  date++;\n  today();\n};\ntoday();\n````\nThe above code is an example.\nIt'll print Apologize if `good boy` or it will go on forever because the day never comes.\n\n## Variable\n\n````kotlin\nval text = \"Hello, World!\";\n````\n\nSketch supports four types of values - strings, numbers, booleans (`true`/`false`), `null` and array.\n````kotlin\nval happy = true;\nif (happy) {    happy = null;   };\n````\n\n## Arrays\n````kotlin\nval array = array(7);\narray[0] = 7;\n\nfor x (1 -\u003e len(array) - 1) {\n    array[x] = array[x - 1] * 2;\n}\nprintf(array);\n````\nprints `[7.0, 14.0, 28.0, 56.0, 112.0, 224.0, 448.0]\n`\n\n## Conditions\n\nThere are two types of condition checks, i.e. ternary operator and `if else`.\n\n````kotlin\nif (happy) {\n  print(\"Happy Day :D\");  \n} else {\n  print(\"Oh, No :(\");  \n};\n````\nInline operator (ternary).\n\u003cbr\u003e\nSyntax `[condition] then [expression] or [expression]`\n````vertica\nprint(happy then \"Hello, World\" or \"No :/\");\n````\n## Functions\n\nYou can define a function in sketch.\n\u003cbr\u003e\n`null` is the default value if you don't return anything.\n````kotlin\nfun hello(arg) {\n    if (arg != 7 \u0026\u0026 arg + 2 == 10) {\n        return \"that was right\";\n    };\n    return \"Ah, No\";\n};\n\nprint( hello(8) );\n````\n## Loops\n\nYes, 😉 Sketch supports two types of loops - for loop and while loop.\n\n````kotlin\nfun hello(arg) {\n    for x (1 \u003c- 7) {\n        print(x);\n        if (x == 5) {  break;  };\n    };\n};\n\nprint( hello(8) );\n````\n\nIt also supports `forward` statement, which can be used to forward loop x times.\n````kotlin\nfun hello() {\n    for x (1 \u003c- 7) {\n        print(x);\n        if (x == 5) {  forward 2;  };\n    };\n};\nhello();\n````\n\nReverse loop can be performed through `\u003c-` symbol. `-\u003e` for a forward loop.\n\n````kotlin\nval x = 7;\nwhile (x \u003e 0) {\n    print(\"value of x \" + --x);\n};\n````\n\n## Import\n\n````kotlin\nwith Sketch.systemTime clock;\n\nfun fib(n) {\n  if (n \u003c 2) {\n    return n;\n  }\n  return fib(n - 1) + fib(n - 2);\n}\n\nval before = clock();\nprint(fib(40));\nprint(clock() - before);\n````\n\nInternal functions can be implemented with the use of `with` statement.\n\u003cbr\u003e\n`with \u003cfrom\u003e \u003cfunction\u003e \u003coptional_function_rename\u003e`\n\n## Running\n\nYou can clone the repository, run the `Main` file or use the `jar` file from the releases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxomadev%2Fsketch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxomadev%2Fsketch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxomadev%2Fsketch/lists"}