{"id":37168068,"url":"https://github.com/codr7/gapl","last_synced_at":"2026-01-14T19:52:24.089Z","repository":{"id":161215049,"uuid":"422083715","full_name":"codr7/gapl","owner":"codr7","description":"a Go scripting language/toolkit","archived":false,"fork":false,"pushed_at":"2021-11-22T21:35:03.000Z","size":3036,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-21T19:56:24.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/codr7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2021-10-28T06:02:58.000Z","updated_at":"2024-05-27T16:49:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7c8a5ec-8c5b-47d9-adfd-b02c339f7774","html_url":"https://github.com/codr7/gapl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codr7/gapl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codr7%2Fgapl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codr7%2Fgapl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codr7%2Fgapl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codr7%2Fgapl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codr7","download_url":"https://codeload.github.com/codr7/gapl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codr7%2Fgapl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28433379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-14T19:52:23.499Z","updated_at":"2026-01-14T19:52:24.074Z","avatar_url":"https://github.com/codr7.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## g/\u003epl\n\n```\ng/\u003epl 8\npress Return on empty line to Eval\nmay the Source be with You\n\n  func fib (n Int) (Int) \n    if \u003c n 2 n + fib - n 1 fib - n 2\n  fib 10\n\n[55]\n```\n\n### intro\ng/\u003epl is a interpreted scripting language/toolkit implemented in Go.\n\n### status\nThe functionality described in this document is implemented and verified to work but not much else at the moment, any ideas for improvements are most welcome.\n\n### syntax\nThe provided syntax is relatively simple and trivial to customize/replace.\n\n- Forms are separated by whitespace.\n- All calls are prefix.\n- The input stream is consumed until all arguments have been collected (recursively).\n- Forms may be grouped using parens.\n\n### scripts\n`include` may be used to load external scripts.\n\ntest.gapl\n```\n  42\n```\n```\n  include \"test.gapl\"\n\n[42]\n```\n\n### libraries\nThe REPL imports everything by default while scripts start with nothing but `import`.\n\n`import` may be used to import identifiers into the current scope, an empty list indicates everything.\n\n```\n  import abc ()\n  import math (+ -)\n```\n\n### stack\n`d` may be used to drop the top `n` values.\n\n```\n  1 2 3 4 5\n\n[1 2 3 4 5]\n  dd\n\n[1 2 3]\n```\n\n### bindings\nIdentifiers may be bound once per scope using `let`.\n\n```\n  let foo 42\n\n[]\n  let foo 42\n\nError in repl at line 0, column 0: Duplicate binding: foo 42\n```\n\n`_` may be used as a placeholder to pop the stack.\n\n```\n  42\n\n[42]\n  let foo _\n\n[]\n  foo\n\n[42]\n```\n\n### functions\nNew functions may be defined using `func`.\n\n```\n  func foo () (Int) 42\n  foo\n\n[42]\n```\n\n`ret` may be used to return early.\n\n```\n  func foo () (Int) (35 ret 7)\n  foo\n\n[35]\n```\n\nAnonymous functions may be created by omitting the name.\n\n```\n  func () (Int Int) (35 7)\n\n[Func(() (Int Int))]\n  call _\n\n[35 7]\n```\n\nFunctions are lexically scoped,\n\n```\n  func foo () (Int) (\n    func bar () (Int) 42\n    bar\n  )\n\n[]\n  foo\n\n[42]\n  bar\n\nError in repl at line 0, column 0: Unknown id: bar\n```\n\nand capture their defining environment.\n\n```\n  func foo () (Func) (\n    let bar 42\n    func () (Int) bar\n  )\n\n[]\n  call foo\n\n[42]\n```\n\n#### call flags\nCall flags may be specified by prefixing with `|`.\n\n##### |d(rop)\nDrops returned values.\n\n##### |t(co)\nPerforms tail call optimization.\n\n##### |u(nsafe)\nDisables all type checks for the duration of the call.\n\n### continuations\n`suspend` may be used to capture the continued evaluation as a value.\n\n```\n  suspend ()\n  42\n[Cont(1)]\n  resume _\n\n[42]\n```\n\nThe continuation is passed on the stack.\n\n```\n  suspend resume _\n  42\n\n[42]\n```\n\n### tests\n`test` may be used to evaluate a test case and raise an error if it doesn't produce the expected stack.\n\n```\n  test [1 2 3] (1 2 4)\n\nError in repl at line 0, column 0: Test failed: [1 2 3] [1 2 4]\n```\n\n### performance\ng/\u003epl currently runs at around half the speed of Python3, any ideas on how to improve performance further are most welcome.\n\n```\n$ cd bench\n$ python3 fibrec.py\n233\n```\n\n```\n  func fibrec (n Int) (Int) \n    if \u003c n 2 n + fibrec - n 1 fibrec - n 2\n  bench 100 fibrec|d 20\n\n[562]\n```\n\n```\n$ python3 fibtail.py\n105\n```\n\n```\n  func fibtail (n Int a Int b Int) (Int)\n    if = n 0 a if = n 1 b fibtail|t - n 1 b + a b\n  bench 10000 fibtail|d 70 0 1\n\n[114]\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodr7%2Fgapl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodr7%2Fgapl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodr7%2Fgapl/lists"}