{"id":19837763,"url":"https://github.com/willghatch/cpslc","last_synced_at":"2026-06-04T20:31:00.102Z","repository":{"id":12380794,"uuid":"15032617","full_name":"willghatch/cpslc","owner":"willghatch","description":"Compiler for CPSL -- a Pascal-like language for school projects","archived":false,"fork":false,"pushed_at":"2015-05-05T01:55:46.000Z","size":412,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T11:15:44.906Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willghatch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-08T22:22:29.000Z","updated_at":"2015-05-05T01:55:46.000Z","dependencies_parsed_at":"2022-09-23T06:12:30.169Z","dependency_job_id":null,"html_url":"https://github.com/willghatch/cpslc","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willghatch%2Fcpslc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willghatch%2Fcpslc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willghatch%2Fcpslc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willghatch%2Fcpslc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willghatch","download_url":"https://codeload.github.com/willghatch/cpslc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241202649,"owners_count":19926653,"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":"2024-11-12T12:15:35.226Z","updated_at":"2026-06-04T20:31:00.067Z","avatar_url":"https://github.com/willghatch.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"cpslc \n=====\n\nthe Compilers Project Source Language Compiler\n\nBy William Hatch (willghatch@gmail.com)\n\nAn exciting class project for CS5300 at Utah State University.\n\nCompiles CPSL to mips assembly suitable for running on spim or MARS simulators.\n\nBuilt to comply with the specification document included as CPSL.pdf (also available\nin source from https://github.com/ksundberg/CS5300).\nThe test files from the class are also included in the ClassTestFiles directory (copied\nin case future classes change the specifications of the compiler, etc).  They are also\navailable from Dr. Sundberg's git repository given above.\n\nThe executable `cpslc` is the compiler.\nIt prints a lovely help message if run with -h, --help, or an unknown argument.\nSyntax is:\n`cpslc [-hv] [-f infile] [-o outfile]`\nwhere the flags can be replaced by --help, --verbose, --file, and --output respectively.\n\n\nThe executable `lextest` is just a lexical analyzer.  It prints int values for the symbols found, and their yylval\nvalue if they're an identifier or constant (int, string, or char).  It takes the name of a file or\nit reads from stdin.\n\n\nJust run `make` to build, and there should be no problems as long as you have:\n- bison\n- flex\n- c/unix standard libraries\n\nComments\n--------\n\nSince I'm not sure what libraries the grader will have installed, and to not have\nhim install any more, I rolled some of my own stuff (linked list, etc) that I would\notherwise have used a library for.  I wanted to use pure C instead of C++ to get\nsome more experience with just C.\n\nThe style of the code is pretty bad -- I mixed a hodgepodge of styles, as I was\nkinda trying to find what style I liked for straight C.  Some of the code in\nsymtab.c and symtab.h I took from the class slides on the symbol table stuff.\nI'm not really sure why I re-used class code for that and nothing else... but that's\nwhat happened.\n\nIt was fun and fulfilling to make.  I'm really glad I took this class and wrote this\ncompiler.\n\nI'll probably put this on github, because hey, I built a compiler.  If random people\nfrom the internet inspect this code remember:  It was a school project.  Corners were\ncut.  Documentation was ignored.  It's mostly awful.  But it works... so... pedagogical\ngoal completed I suppose.\n\nKnown Issues\n------------\n\nIf you have a long expression of the right type, you might run out of registers.\nThere is no register spilling code.  But you should be safe unless you have something\nlike a + (b + (c + (d + (e + f)))).  And it would have to be longer.  So I've never\nactually run into the problem.\n\nError messages are pretty bad.  Oh well.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillghatch%2Fcpslc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillghatch%2Fcpslc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillghatch%2Fcpslc/lists"}