{"id":20425296,"url":"https://github.com/catseye/yucca","last_synced_at":"2025-09-15T08:27:23.067Z","repository":{"id":49164712,"uuid":"3564949","full_name":"catseye/yucca","owner":"catseye","description":"MIRROR of https://codeberg.org/catseye/yucca : A dialect-agnostic static analyzer for 8-bit BASIC programs","archived":false,"fork":false,"pushed_at":"2023-10-27T11:27:22.000Z","size":28,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-15T15:11:57.323Z","etag":null,"topics":["basic-programming-language","code-smells","static-analysis","static-analyzer"],"latest_commit_sha":null,"homepage":"https://catseye.tc/node/yucca","language":"Python","has_issues":false,"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/catseye.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":"2012-02-27T21:22:17.000Z","updated_at":"2023-10-25T18:57:41.000Z","dependencies_parsed_at":"2025-01-15T15:08:53.604Z","dependency_job_id":"75f64acb-d8b7-463b-be5f-2ce16b4230fb","html_url":"https://github.com/catseye/yucca","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2Fyucca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2Fyucca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2Fyucca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2Fyucca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catseye","download_url":"https://codeload.github.com/catseye/yucca/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241966977,"owners_count":20050324,"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-programming-language","code-smells","static-analysis","static-analyzer"],"created_at":"2024-11-15T07:12:48.722Z","updated_at":"2025-03-05T04:45:09.871Z","avatar_url":"https://github.com/catseye.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"yucca\n=====\n\nVersion 1.2 | _Entry_ [@ catseye.tc](https://catseye.tc/node/yucca)\n| _See also:_ [hatoucan](https://codeberg.org/catseye/hatoucan#hatoucan)\n∘ [Bubble Escape](https://codeberg.org/catseye/Bubble-Escape#bubble-escape)\n∘ [Dungeons of Ekileugor](https://codeberg.org/catseye/Dungeons-of-Ekileugor#dungeons-of-ekileugor)\n∘ [Apple Befunge](https://codeberg.org/catseye/Apple-Befunge#apple-befunge)\n\n- - - -\n\nIT SO HAPPENS in the course of human events that one may find oneself \ncross-developing an 8-bit BASIC program from a modern development \nenvironment.\n\nIN THESE CASES it behoves one to take advantage of the aforementioned \nmodern development environment to increase one's confidence that the \ncross-developed code is correct.\n\nIT IS FOR THIS PURPOSE that _yucca_ was developed.  It is a small Python \nprogram which can perform static analysis on 8-bit BASIC programs.\nSpecifically, it can, at present, check that every line number which is \na target of a jump is actually present in the program.  If it is not, an \nerror message describing the inconsistency is given.\n\nWITH GENERAL APPLICABILITY in mind, yucca recognizes the common forms of \njumps available in BASIC (`GOTO`, `GOSUB`, `ON ... GOTO`, `ON ... \nGOSUB`, `IF ... GOTO`, and `IF ... THEN` followed by a line number)\nwhile ignoring any constructs it does not understand.  This allows it to\nbe dialect-agnostic, with the unavoidable limitation that it cannot \nrecognize (and thus will not check) computed `GOTO`s or any \ndialect-specific command that involves line numbers.\n\nTHE BASIC PROGRAM to be analyzed must be present in a textual form.\nSome emulators allow such text to be pasted in, to simulate entering it \nat the 8-bit computer's keyboard; other tools are available to convert a \ntokenized BASIC program to a textual form and back.  `yucca` handles\nboth styles of text file; it can even analyze and manipulate commands in\nimmediate mode, in the case of the listing being a 'session transcript.'\n\nCase Studies\n------------\n\n`yucca` has been successfully used on:\n\n* The editor for [Apple Befunge][] -- `APPLE BEFUNGE EDITOR.bas` is a\n  'session transcript' intended to be pasted into an emulator;\n* The original version of [Bubble Escape][] -- `bubble escape.bas` is a\n  text file detokenized from the original tokenized program;\n* [Dungeons of Ekileugor][] -- an original text file, intended to be\n  checked and stripped by `yucca`, then passed to a tokenizer such as\n  `petcat` or [hatoucan][] to create a loadable VIC-20 BASIC program file.\n\n[Apple Befunge]: http://catseye.tc/node/Apple_Befunge\n[Bubble Escape]: http://catseye.tc/node/Bubble_Escape\n[Dungeons of Ekileugor]: http://catseye.tc/node/Dungeons_of_Ekileugor\n[hatoucan]: http://catseye.tc/node/hatoucan\n\nUsage\n-----\n\n    yucca program.bas\n\nPython's `fileinput` module is used, so the BASIC source can also be piped\ninto `yucca`, and so forth.  Error messages are printed on the standard error\nstream.\n\nBy default, `yucca` checks that each line number in the program source is\ngiven in strictly ascending order.  Some tokenizers (e.g. `petcat`) will\nhappily tokenize a program source into a tokenized program with\nout-of-sequence and/or duplicate line numbers, and this option prevents\nthat from happening.  To suppress this check, give the `-A` option on the\ncommand line.\n\nBy default, `yucca` checks that the target of each jump in the program is an\nexisting line number.  This includes any jumps that may occur in immediate\nmode commands (i.e. commands with no line number) given in the text\nfile.  If this check fails, further transformations may not be performed on\nthe program.  To suppress this check, pass the `-L` option to `yucca`.\n\n`yucca` cannot analyze the validity of any computed line number in a BASIC\nprogram which contains computed `GOTO`s or `GOSUB`s.  To reduce the chance\nof an computed line number going unnoticed and unanalyzed, `yucca`'s\ndefault behavior is to report an error if it finds any computed `GOTO`s\nor `GOSUB`s in the input program.  To acknowledge that you are aware that\nthe program contains computed jumps that `yucca` will not be able to\nanalyze, pass the `-C` option to have `yucca` suppress these errors.\n\nThe `-o` option may be given to dump a copy of the program to the standard\noutput.  This option is implied by the following two options.\n\nThe `-I` option strips all immediate mode commands from the program before\nanalyzing and outputting it.\n\nThe `-R` option strips all remarks (`REM` statements) from the program\nbefore analyzing and outputting it.  Note that this happens before\nanalysis, so that any jumps to lines which contain only a `REM` will be\nfound and reported.\n\nThe `-p` option causes all program transformations to act only on program\nlines, not on immediate mode lines.  Thus, in combination with `-R`, `REM`s\non immediate mode lines are not removed.  It does not affect `-I` at all.\n\nThe `-x` option allows symbol constants to be defined in, and expanded in,\na yucca source.  A symbolic constant is any alphanumeric token inside\nsquare bracket.  A symbolic constant is defined by placing it as the first\nthing on a line, followed immediately by an equals sign, followed immediately\nby the value it represents.  Such lines will be stripped, and the values for\nthose constants expanded in other lines, when `-x` is given.\n\nThe `-t` option runs `yucca` through its internal test suite and exits\nimmediately.\n\nPlans\n-----\n\n`yucca` could be easily extended to warn about \"code smells\" such as a \nredundant `GOTO` to the next line, a `GOTO` to a line containing only\nanother `GOTO`, and so forth.\n\n`yucca` can dump the input program with (as far as I can tell) total\nfidelity; it retains case and spacing of all lines, even leading and\ntrailing whitespace.\n\nThis facility could be built upon to give `yucca` the ability to\nrenumber a program, or to supply missing line numbers, or even transform\na program with textual labels into one with line numbers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatseye%2Fyucca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatseye%2Fyucca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatseye%2Fyucca/lists"}