{"id":13608300,"url":"https://github.com/KarlAndr1/beryl","last_synced_at":"2025-04-12T14:32:34.331Z","repository":{"id":179672905,"uuid":"663950546","full_name":"KarlAndr1/beryl","owner":"KarlAndr1","description":"The Beryl Scripting Language","archived":false,"fork":false,"pushed_at":"2023-10-20T11:17:10.000Z","size":263,"stargazers_count":31,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-07T13:40:52.708Z","etag":null,"topics":["embeddable-scripting-language","interpreted-programming-language","scripting-language"],"latest_commit_sha":null,"homepage":"","language":"C","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/KarlAndr1.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}},"created_at":"2023-07-08T14:15:03.000Z","updated_at":"2024-09-02T14:28:53.000Z","dependencies_parsed_at":"2024-04-16T07:47:43.169Z","dependency_job_id":null,"html_url":"https://github.com/KarlAndr1/beryl","commit_stats":null,"previous_names":["karlandr1/beryl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarlAndr1%2Fberyl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarlAndr1%2Fberyl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarlAndr1%2Fberyl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarlAndr1%2Fberyl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KarlAndr1","download_url":"https://codeload.github.com/KarlAndr1/beryl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248581352,"owners_count":21128154,"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-scripting-language","interpreted-programming-language","scripting-language"],"created_at":"2024-08-01T19:01:26.188Z","updated_at":"2025-04-12T14:32:33.827Z","avatar_url":"https://github.com/KarlAndr1.png","language":"C","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# The Beryl programming language\n\nBeryl is a small programming language with value semantics that is largely based off of (and shares some code with) legacy Beryl.\nLike legacy Beryl it is an embeddable scripting language that executes directly from source code, no parsing or compiling done ahead of time.\nMost of the core language can run without access to libc or any dynamic allocation functions like malloc.\n\n## Examples\n\nHello world:\n```\nprint \"Hello world!\"\n```\n\nfib.beryl:\n```\nlet fib = function n do\n\tif (n == 0) or? (n == 1) do\n\t\tn\n\tend else do\n\t\t(fib n - 1) + (fib n - 2)\n\tend\nend\n```\nNote that 'if' is a function, just like 'print' or 'fib'.\n\nloop.beryl:\n```\nfor 1 11 with i do\n\tprint i\nend\n```\nThis prints the numbers 1, 2, ..., 10. for is also a function defined in the standard library.\n\nMore code examples can be found in ./test_scripts\n\n## Building/Installing\n\n### Unix\n\nRun\n```\nmake\n```\nto build the project.\nRun\n```\nmake install\n``` \nto install the built executable and set up the required directories and environment variables locally (in home directory).\nTo install globally run\n```\nsudo make install-global\n```\n\nAlternatively, without making use of the Makefiles, one can instead first run build.sh\n```\n./build.sh\n```\nWhich will build the project and all the external/optional libraries. Then run install.sh to install everything and\nset up the environment.\n```\n./install_local.sh\n```\nor\n```\n./install_global.sh\n```\n\n## Windows\n\nWindows support has not been tested; both the interpreter and the installer/build script may exhibit bugs.\n\nFirst run\n```\nmake windows\n```\n\nThen run install.bat\n```\n./install.bat\n```\n\n## Embedding\n\nThe language is written in C99 and is easy to embedd:\n```\n#include \"beryl.h\"\n\n#include \u003cstring.h\u003e\n#include \u003cassert.h\u003e\n\n// -------------------\n\t\n\tberyl_load_included_libraries();\n\t// beryl_set_mem(malloc, free, realloc) // Only needed for dynamic allocation, like `array 1 2 3`\n\t\n\tconst char *prog = \n\t\t\"let sum = 0\\n\"\n\t\t\"for 1 11 with i do \\n\"\n\t\t\"\tsum += i \\n\"\n\t\t\"end \\n\"\n\t\t\"sum\";\n\n\tstruct i_val result = beryl_eval(prog, strlen(prog), BERYL_PRINT_ERR);\n\tdouble num = beryl_as_number(result);\n\tassert(num == 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10);\n\n```\nIt is possible to call custom C functions from within Beryl, as well as to call Beryl functions from C; Indeed the entire\nstandard library is implemented via this API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKarlAndr1%2Fberyl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKarlAndr1%2Fberyl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKarlAndr1%2Fberyl/lists"}