{"id":29002322,"url":"https://github.com/krzysckh/nienor","last_synced_at":"2025-08-29T08:33:57.712Z","repository":{"id":297430361,"uuid":"996192420","full_name":"krzysckh/nienor","owner":"krzysckh","description":"a lispy environment for uxn","archived":false,"fork":false,"pushed_at":"2025-08-27T22:08:05.000Z","size":416,"stargazers_count":28,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-28T06:39:01.835Z","etag":null,"topics":["lisp","owl-lisp","scheme","uxn"],"latest_commit_sha":null,"homepage":"","language":"Scheme","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krzysckh.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,"zenodo":null}},"created_at":"2025-06-04T15:33:09.000Z","updated_at":"2025-08-27T22:08:08.000Z","dependencies_parsed_at":"2025-06-20T17:22:54.352Z","dependency_job_id":"baf9c5d9-9d01-4eff-acb0-77e98bee1b0b","html_url":"https://github.com/krzysckh/nienor","commit_stats":null,"previous_names":["krzysckh/nienor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/krzysckh/nienor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzysckh%2Fnienor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzysckh%2Fnienor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzysckh%2Fnienor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzysckh%2Fnienor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krzysckh","download_url":"https://codeload.github.com/krzysckh/nienor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzysckh%2Fnienor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272655964,"owners_count":24971221,"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","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["lisp","owl-lisp","scheme","uxn"],"created_at":"2025-06-25T10:01:20.015Z","updated_at":"2025-08-29T08:33:57.702Z","avatar_url":"https://github.com/krzysckh.png","language":"Scheme","funding_links":[],"categories":["Development tools","Scheme"],"sub_categories":["Assemblers, compilers \u0026 disassemblers"],"readme":"# niënor\n\na lispy environment for uxn\n\n## building\n\ninstall [owl lisp](https://gitlab.com/owl-lisp/owl.git)\n\n```sh\n$ make all\n$ ./bin/nienor -h\n```\n\nIf you don't wish to build it from source, you could try the [web demo](https://pub.krzysckh.org/nienor-web-demo).\nIt's the same thing, just running in wasm. I don't promise to keep it up to date with @master though.\n\n## examples\n\n### Hello, World!\n\n```scheme\n(define (main)\n  (puts \"Hello, World!\\n\")\n  (exit!))\n```\n\n```sh\n# compile hello.scm to hello.rom and run it\n$ bin/nienor hello.scm -o hello.rom \u0026\u0026 uxnemu hello.rom\nAssembled hello.rom in 966.00B (1.47% used), 59 labels\nHello, World!\nRun: Ended.\n# dump hello.scm as uxntal, compile it with uxnasm and run it\n$ bin/nienor -o hello.tal -D hello.scm \u0026\u0026 uxnasm hello.tal hello.rom \u0026\u0026 uxnemu hello.rom\nAssembled hello.rom in 965 bytes(1.48% used), 0 labels, 0 macros.\nHello, World!\nRun: Ended.\n```\n\n### Varvara wrappers\n\n```scheme\n(define (main)\n  (set-colors! #xffff #x0000 #x000)\n  (set-draw-handler! on-draw))\n\n(define-vector (on-draw)\n  (fill! 0 0 color-1 layer-0))\n```\n\n### Macros\n\n```scheme\n(alloc! spr #xf0 #xf0 #xf0 #xf0 #x0f #x0f #x0f #x0f)\n\n(define-macro-rule (being execute) ; \u003c- being and execute are literals\n  (with-draw-handler being f execute . body)\n  (begin\n    (set-draw-handler! f) . body))\n\n(define (main)\n  (with-draw-handler being draw execute\n    (set-screen-width! 400)\n    (set-screen-height! 300)\n    (set-colors! #x0f00 #x00f0 #x000f)\n    (print-number 42)))\n\n(define-vector (draw)\n  (loopn (i 0 4 1)\n    (fill-rect! spr i (* i 100) 0 (+ 100 (* i 200)) 300 0)))\n```\n\n### Anonymous functions\n\n```scheme\n(alloc! *str* \"test\\n\")\n\n(define (apply1 f arg)\n  (f arg))\n\n(define (main)\n  (let ((printc (λ (c) (putchar c))))\n    (loopn (i 0 5 1)\n      (apply1 printc (get8! (+ *str* i)))))) ; \u003c- get8! is a byte dereference.\n                                             ; get! would dereference a short\n```\n\n### Closures\n\n```scheme\n(define (make-adder a)\n  (λ (b)\n    (λ (c)\n      (+ a b c)))) ; \u003c- vararg + (it's a macro)\n\n(define (main)\n  (let ((f ((make-adder 21) 10)))\n    (print-number (f 11))\n    (exit 128)))\n```\n\n### TCO\n\n```scheme\n(define-signature test-call-stack Number -\u003e Number)\n(define (test-call-stack n)\n  ;; (print-number n) ; \u003c- uncomment this to get a countdown from #xffff to 0\n  (if (equ? n 0)\n      0\n      (test-call-stack (- n 1))))\n\n(define (main)\n  (print-number (test-call-stack #xffff))\n  (exit 128))\n```\n\n### Lists\n\nLists are implemented but require manual memory management. Functions that operate on lists\nmight have counterparts that free the arguments after usage.\n\n```scheme\n(let ((l (append (list 1 2 3) (list 4))))\n  (print-list l)) ; =\u003e (1 2 3 4)\n;; This would leak memory allocated for (list 1 2 3) and (list 4),\n;; as `append' creates a new list.\n\n(let ((l (append/ (list 1 2 3) (list 4))))\n  (print-list l)) ; =\u003e (1 2 3 4)\n;; The append/ function runs append, and frees the args passed to it. If you only wish to free\n;; one of the arguments, you have to manage the memory yourself. To free a list use (free-list ...)\n```\n\n### Type checking\n\nThere's a simple typechecker implemented that can catch some errors at compile-time.\nIf it's misbehaving, it may be fully disabled with `--disable-typechecker`.\n\n```scheme\n(define-signature f Number -\u003e String)\n(define (f x)\n  x)\n\n(define (main)\n  (f 0)\n  (exit!))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrzysckh%2Fnienor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrzysckh%2Fnienor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrzysckh%2Fnienor/lists"}