{"id":18163843,"url":"https://github.com/louisjenkinscs/dsl","last_synced_at":"2025-06-28T21:37:20.825Z","repository":{"id":93638817,"uuid":"90412940","full_name":"LouisJenkinsCS/DSL","owner":"LouisJenkinsCS","description":"A minimal, Turing-complete, Domain-Specific Language; simple text editor with an interpreter, Abstract Syntax Tree and reduced Control Flow Graph graphical generator.","archived":false,"fork":false,"pushed_at":"2021-08-23T19:21:07.000Z","size":3244,"stargazers_count":18,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-08T20:53:28.550Z","etag":null,"topics":["abstract-syntax-tree","control-flow-graph","domain-specific-language","grammar","interpreter","language","syntax-tree","turing-completeness"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LouisJenkinsCS.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":"2017-05-05T20:15:08.000Z","updated_at":"2024-04-30T07:18:40.000Z","dependencies_parsed_at":"2023-04-15T02:22:13.564Z","dependency_job_id":null,"html_url":"https://github.com/LouisJenkinsCS/DSL","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/LouisJenkinsCS/DSL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisJenkinsCS%2FDSL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisJenkinsCS%2FDSL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisJenkinsCS%2FDSL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisJenkinsCS%2FDSL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LouisJenkinsCS","download_url":"https://codeload.github.com/LouisJenkinsCS/DSL/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisJenkinsCS%2FDSL/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262503154,"owners_count":23321181,"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":["abstract-syntax-tree","control-flow-graph","domain-specific-language","grammar","interpreter","language","syntax-tree","turing-completeness"],"created_at":"2024-11-02T11:06:19.336Z","updated_at":"2025-06-28T21:37:20.818Z","avatar_url":"https://github.com/LouisJenkinsCS.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DSL\n\nDSL is a very minimal domain specific language, with a problem domain being academic research, designed and created for a Theory of Computation course. Bundled with this program is a simple text editor which allows the user to execute (interpret) code written in the language, generate a graph of the Abstract Syntax Tree for the language, and a reduced Control Flow Graph.\n\n## Screenshots\n\nBelow are screenshots of the Fibonacci problem\n\n### Output from interpretation\n\n![output](screenshots/output.png)\n\n### Generated Abstract Syntax Tree\n\n![ast](screenshots/ast.png)\n\n### Generated Control Flow Graph\n\n![cfg](screenshots/cfg.png)\n\n## Developer's Note and Warning\n\nI would like to note that this project was hacked together in a very brief time under *extremely* tense time constraints, and as such the code quality, to say the *least* is lacking. As well, the logic is counter-intuitive at times, and some things are still buggy and broken. I am officially done with the project, although it does deserve to be displayed here as a lot of work went into it. \n\n### Bugs\n\n#### Control Flow Graph - Basic Block Reduction\n\nControl Flow Graph incorrectly reduces the last node of a while loop into its own basic block due to the wonky reduction algorithm I devised. If anyone wants to work on it, that's one of the first things needing to be done; the Control Flow Graph algorithm needs an entirely new overhaul. It should be noted that control flow itself is correct, as it does introduce a back-edge from the incorrectly-constructed singleton basic block.\n\n## Grammar\n\nThe BNF grammar can be seen below...\n\n```\nprog : prog stmt\n  | stmt\n  | /* Empty */\n  ;\n\nconditional : WHILE expr block\n    | IF expr block \n    | IF expr block ELSE block\n    ;\n\nstmt : VAR NAME '=' expr ';' \n    | NAME '=' expr ';' \n    | conditional \n    | PRINT expr ';' \n    ;\n\nstmt_list : stmt stmt_list \n    | /* Empty */   \n    ;\n\nblock : '{' stmt_list '}'\n    ;\n\n\nexpr : expr '+' expr \n    | expr '-' expr \n    | expr '*' expr \n    | expr '/' expr \n    | expr EQ expr\n    | expr NEQ expr\n    | expr GE expr \n    | expr LE expr \n    | expr '\u003e' expr \n    | expr '\u003c' expr \n    | '(' expr ')' \n    | INTEGER \n    | STRING \n    | NAME \n    ;\n\n```\n\n\n### Code Example\n\n```\nvar x = 0;\nvar y = 100;\nwhile (x \u003c y) {\n  if (x == 10) {\n    print \"X: \" + x;\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisjenkinscs%2Fdsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouisjenkinscs%2Fdsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisjenkinscs%2Fdsl/lists"}