{"id":29028555,"url":"https://github.com/finnff/bbycblcompiler","last_synced_at":"2025-06-26T07:35:04.014Z","repository":{"id":300650107,"uuid":"1006713308","full_name":"finnff/bbyCBLcompiler","owner":"finnff","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-22T21:54:17.000Z","size":16053,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-22T22:31:27.231Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/finnff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-22T21:08:51.000Z","updated_at":"2025-06-22T21:54:22.000Z","dependencies_parsed_at":"2025-06-22T22:41:41.626Z","dependency_job_id":null,"html_url":"https://github.com/finnff/bbyCBLcompiler","commit_stats":null,"previous_names":["finnff/bbycblcompiler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/finnff/bbyCBLcompiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnff%2FbbyCBLcompiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnff%2FbbyCBLcompiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnff%2FbbyCBLcompiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnff%2FbbyCBLcompiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/finnff","download_url":"https://codeload.github.com/finnff/bbyCBLcompiler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnff%2FbbyCBLcompiler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262023023,"owners_count":23246431,"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":[],"created_at":"2025-06-26T07:34:41.695Z","updated_at":"2025-06-26T07:35:04.003Z","avatar_url":"https://github.com/finnff.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Mainframe Minds bbyCBL Antlr4 Parser 👶\n\n### Prereqisities\n\n1. Extract test files:\n\n```bash\ncd tests\ntar -xvf recombined_formatted.tar.gz\n```\n\n2. Install requirements (`antlr4-tools` + `antlr4-python3-runtime`)\n\n```bash \npip3 install -r requirements.txt\n```\n\n3. Generate parser\n\n```bash\nantlr4 -Dlanguage=Python3 bbyCBL.g4 -o parser   \n```\n\n\n\n### Usage\n\n\n1. Run Parser on test cases\n\n```bash\npython3 parserRunner.py\n```\n\n* *There are some params /debugging options (printing AST's, logging, No. iterations) that can be configured in* `parserRunner.py`\n\n\nThere are also some parameters that can be passed to the script:\n\n```bash\npython parserRunner.py              # Run all tests\npython parserRunner.py -FAILED      # Run only previously failed tests\npython parserRunner.py -CLEAR       # Clear the failed tests directory\npython parserRunner.py -WORKERS N   # Use N worker processes (default: all CPU cores)\n```\n\n\n\n#### recombined_formatted Test Case coverage:\n[\n    \u003cimg\n        src=\"https://github.com/user-attachments/assets/897e8f60-5af5-4ef5-be55-d0d27c2b18b6\"\n        width=\"40%\"\n        title=\"recombined_formatted Test Case coverage\"\n        alt=\"recombined_formatted Test Case coverage\"\n    /\u003e\n](https://github.com/user-attachments/assets/897e8f60-5af5-4ef5-be55-d0d27c2b18b6)\n\n\n\u003e [!WARNING]\n\u003e This current implementation of the parser is tuned almost exclusively for the recombined_formatted test cases. It's not syntactically pretty, particularly readable or adaptable for anything else, or even something that we want to continue working with while implementing the LLVM compiler backend. We're currently working on a more generalized version in the [dev branch](https://github.com/SilasGitHub/software-evolution/blob/dev/bbyCBL.g4) with takeaways gained from the lecture on 7-5, but this is still lacking some features as compared to this version for claiming XP.\n\n### Lexxer+Parser Progress:\n\n\n\n##### Basic Parsing Requirements ✅ \n\n| Requirement | Implemented | Location |\n|-------------|-------------|----------|\n| 1XP - Basic statements (ACCEPT, ALTER, GO TO, IF, PERFORM, SIGNAL) | ✅ | bbyCBL.g4: `acceptStmt`, `alterStmt`, `gotoStmt`, `ifStmt`, `performStmt`, `signalStmt` |\n| 2XP - COPY, DISPLAY, IDENTIFICATION DIVISION | ✅ | bbyCBL.g4: `identificationDivision`, `identificationClause`, `copyStmt`, `displayStmt` |\n| 2XP - Arithmetic operations (ADD, CALL, DIVIDE, MOVE, MULTIPLY, SUBTRACT) | ✅ | bbyCBL.g4: `addStmt`, `callStmt`, `divideStmt`, `moveStmt`, `multiplyStmt`, `subtractStmt` |\n| 3XP - DATA DIVISION (nested structures with OF) | ✅ | bbyCBL.g4: `dataDivision`, `dataEntry`, and `qualifiedId` for OF references |\n| 3XP - EVALUATE, LOOP (detachable clauses) | ✅ | bbyCBL.g4: `evaluateStmt`, `loopStmt` with interleaved `loopControl` and `statement` |\n| 4XP - Sentences, statements (NEXT SENTENCE, STOP) | ✅ | bbyCBL.g4: `sentence`, `nextSentenceStmt`, `stopStmt` |\n\n##### Position-based Parsing \u0026 Line Continuations (4XP) ✅ \n\n| Requirement | Implemented | Location |\n|-------------|-------------|----------|\n| Ignore columns 1-6 (sequence number) | ✅ | preprocess_cobol(): Skips first 6 columns |\n| Process column 7 (line status indicator) | ✅ | preprocess_cobol(): Uses `indicator = line[6]` |\n| Handle space for normal line | ✅ | preprocess_cobol(): `if indicator == \" \"` |\n| Handle asterisk for comment line | ✅ | preprocess_cobol(): `if indicator == \"*\": continue` |\n| Handle hyphen for line continuation | ✅ | preprocess_cobol(): `if indicator == \"-\"` |\n| Raise error for other indicators | ✅ | preprocess_cobol(): `raise ValueError(f\"Invalid line indicator...\")` |\n| Parse Area A (columns 8-11) | ✅ | preprocess_cobol(): `area_a = line[7:11]` and `validate_area()` |\n| Parse Area B (columns 12-72) | ✅ | preprocess_cobol(): `area_b = line[11:72]` and `validate_area()` |\n| Ignore columns 73-80 | ✅ | preprocess_cobol(): Only uses columns up to 72 |\n| Process combined lines with continuations | ✅ | preprocess_cobol(): `current_line = current_line.rstrip() + glue + continuation` |\n\n##### Case Insensitivity (5XP) ✅ \n\n| Requirement | Implemented | Location |\n|-------------|-------------|----------|\n| Case-insensitive keywords and identifiers | ✅ | normalize_case(): Converts keywords to uppercase |\n| Case-sensitive string literals | ✅ | normalize_case(): `if in_string: out.append(ch)` |\n| Case-sensitive PICTURE clauses | ✅ | normalize_case(): `if in_picture: out.append(ch)` |\n| Case-sensitive comment lines | ✅ | preprocess_cobol(): Comment lines are skipped entirely |\n| Case-sensitive ID division values | ✅ | normalize_case(): `if in_id_value: out.append(ch)` |\n| Ambiguity resolution - uppercase keywords | ✅ | normalize_case(): `if lower in ALL_KEYWORDS: out.append(word.upper())` |\n\n##### Whitespace Insignificance (5XP) ⚠️\n\n| Requirement | Implemented | Location |\n|-------------|-------------|----------|\n| Preserve whitespace in strings | ✅ | normalize_case(): Preserves all characters in strings |\n| Preserve whitespace in comments | ✅ | preprocess_cobol(): Comment lines are kept intact (though skipped) |\n| Preserve whitespace in ID division values | ✅ | normalize_case(): Preserves characters in ID values |\n| Ignore other whitespace | ⚠️ | Partial: ANTLR grammar has `WS: [ \\t\\r\\n]+ -\u003e skip;` but doesn't handle all cases |\n| Ambiguity resolution with whitespace | ⚠️ | Partial: join_without_space logic helps but doesn't fully implement the test cases |\n\n\n\n\n\n\n\n#### Example Parse Error debug info:\n\n\n[\n    \u003cimg\n        src=\"https://github.com/user-attachments/assets/19600a5c-9751-4663-b377-640dadfed993\"\n        width=\"70%\"\n        title=\"Example Parsing Errors have debugging\"\n        alt=\"Example Parsing Errors have debugging\"\n    /\u003e\n](https://github.com/user-attachments/assets/19600a5c-9751-4663-b377-640dadfed993)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinnff%2Fbbycblcompiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinnff%2Fbbycblcompiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinnff%2Fbbycblcompiler/lists"}