{"id":26798188,"url":"https://github.com/krzys9876/z80_basic","last_synced_at":"2025-07-10T15:41:20.868Z","repository":{"id":42676706,"uuid":"510895628","full_name":"krzys9876/z80_basic","owner":"krzys9876","description":"MS Basic interpreter in Scala","archived":false,"fork":false,"pushed_at":"2022-09-26T11:09:56.000Z","size":200,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-10T09:36:46.007Z","etag":null,"topics":["basic","functional-programming","immutability","scala","z80"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/krzys9876.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":"2022-07-05T21:13:03.000Z","updated_at":"2023-03-04T00:40:05.000Z","dependencies_parsed_at":"2023-01-18T14:01:48.974Z","dependency_job_id":null,"html_url":"https://github.com/krzys9876/z80_basic","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzys9876%2Fz80_basic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzys9876%2Fz80_basic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzys9876%2Fz80_basic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzys9876%2Fz80_basic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krzys9876","download_url":"https://codeload.github.com/krzys9876/z80_basic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246230504,"owners_count":20744349,"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":["basic","functional-programming","immutability","scala","z80"],"created_at":"2025-03-29T19:17:21.461Z","updated_at":"2025-03-29T19:17:22.110Z","avatar_url":"https://github.com/krzys9876.png","language":"Scala","readme":"# MS Basic Interpreter in Scala #\n\nFollowing the Z80 simulator in Scala (https://github.com/krzys9876/z80_sim_scala), this is \na MS Basic interpreter to run similar programs. As always it's mostly for fun and for practicing \nFP, immutability, class composition and parser combinators.\n\nI did not intend to implement all Basic commands - the list is quite long but I realised that\nactually most of my example programs use just a small portion of all available statements. \nSo I chose the core: printing, loop, jumps, conditionals.\n\nMy implementation is not strict, e.g. I did not put constraints on numbers, string length, \nprinting is a little different too bit overall the programs do what they are intended to.\nI did not implement string operations at all as I hardly use them in Basic.\n\nI've spent quite some time on parser combinators, learning and browsing for simple solutions.\nI tried hard not to create a huge one-class-to-parse-them-all. This is where scala traits shine - \nthey allow separating logical bits from one another yet combining them seamlessly (just be aware of\ncircular dependencies).\n\n## Keywords and functionality\n\n\u003cimg src=\"https://img.shields.io/badge/PRINT-Done-green.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/FOR / NEXT-Done-green.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/IF-Done-green.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/GOTO-Done-green.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/GOSUB / RETURN-Done-green.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/Numeric Expressions-Done-green.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/Text expressions-Partially done-lightgray.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/DIM / Arrays-Done-green.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/DATA / READ-Done-green.svg\"/\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://img.shields.io/badge/STOP-Done-green.svg\"/\u003e\u003c/a\u003e\n\nThis is enough to run tic-tac-toe (10x10) game, which was a test program for Z80 simulator. \n\n## Program execution ##\n\nI was wondering how to enable parameterized program execution, i.e. how to easily choose between \nexecuting e.g. first X steps or finishing after Y seconds etc. \n\nI came up with the idea of Iterator and Iterable classes (I know, the names are so general that they may be \neasily confused...). Iterator simply runs a step method of a Iterable object and checks if the execution is over\nby invoking an external function. Is it an overkill for this purpose? Well, it may be but this is \nalso a brain-teaser, and that's what fun projects are all about :smile:\n\nThis also enables different execution of test (i.e. always run a test program to an end and check the results)\nvs runtime.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrzys9876%2Fz80_basic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrzys9876%2Fz80_basic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrzys9876%2Fz80_basic/lists"}