{"id":22846561,"url":"https://github.com/jsonkao/graphics-compilers","last_synced_at":"2025-03-31T05:41:24.807Z","repository":{"id":114470624,"uuid":"132471577","full_name":"jsonkao/graphics-compilers","owner":"jsonkao","description":"Graphics compiler assignment.","archived":false,"fork":false,"pushed_at":"2018-05-09T15:01:18.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T10:15:23.809Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/jsonkao.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}},"created_at":"2018-05-07T14:22:01.000Z","updated_at":"2021-02-09T20:49:44.000Z","dependencies_parsed_at":"2023-06-08T07:15:39.340Z","dependency_job_id":null,"html_url":"https://github.com/jsonkao/graphics-compilers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonkao%2Fgraphics-compilers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonkao%2Fgraphics-compilers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonkao%2Fgraphics-compilers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonkao%2Fgraphics-compilers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsonkao","download_url":"https://codeload.github.com/jsonkao/graphics-compilers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246423494,"owners_count":20774796,"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-12-13T03:29:38.003Z","updated_at":"2025-03-31T05:41:24.789Z","avatar_url":"https://github.com/jsonkao.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# compilers\nGraphics compiler assignment.\n\nname | input | output\n--- | --- | ---\n[Lexer](#lexers) | source code | token list\n[Parser (syntax)](#parser) | token list | syntax tree\n[Semantic Analyzer](#semantic-analyzer) | syntax tree | operation list, symbol table\n\n1. Lexer (input is source code): performs lexical analysis\n- Knows valid keywords, literal formats, and identifier formats.\n- It does not interpret anything; it only looks for invalid code.\n2. Syntactic analyzer: structure, grammar of code\n- The lexer's token list is given to the syntactic analyzer, which determines if the order makes sense\n3. Semantic analyzer: meaning (e.g. types)\n4. Optimizer (optional)\n5. Code generator: receives output of semantic analyzer and generates an executable or image (or multiple images).\n\n# Lexers\n\nTypes of language tokens:\n- grouping symbols (;, {}, (), ...)\n- operators\n- identifiers\n- keywords\n- literals\n\nThe lexer outputs a list of tokens and gives it to the syntactic analyzer.\n\nWe use lex or flex (free lex) to define our tokens. In C, it looks like:\n```\n[a-zA-Z][\\.a-zA-Z0-9_]* {\n  strcpy(yyval.string, yytext); return STRING;\n}\n```\n\n# Parser\n\n- Performs syntax analysis\n- Checks if token list for valid structure\n- Knows the grammar of the language\n\n# Semantic Analyzer\n\nAs a program runs, values change. That is the point of the symbol table.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsonkao%2Fgraphics-compilers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsonkao%2Fgraphics-compilers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsonkao%2Fgraphics-compilers/lists"}