{"id":22177310,"url":"https://github.com/alvarorichard/cortexc","last_synced_at":"2025-07-26T16:31:27.014Z","repository":{"id":182198639,"uuid":"668098859","full_name":"alvarorichard/CortexC","owner":"alvarorichard","description":" Interpreter is a minimalist yet powerful tool designed to interpret and execute a subset of the C programming language. ","archived":false,"fork":false,"pushed_at":"2024-03-03T04:05:33.000Z","size":24306,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-11T05:45:44.487Z","etag":null,"topics":["binary","c","education","evaluation","intepreter","interpreter","open-source","parsing","programming-language","tokenization","zig"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"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/alvarorichard.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}},"created_at":"2023-07-19T03:01:10.000Z","updated_at":"2024-05-04T08:46:28.000Z","dependencies_parsed_at":"2024-03-03T03:23:27.190Z","dependency_job_id":"e73b659f-e2f0-4324-b6ce-0aeb68939853","html_url":"https://github.com/alvarorichard/CortexC","commit_stats":null,"previous_names":["alvarorichard/cortexc"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarorichard%2FCortexC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarorichard%2FCortexC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarorichard%2FCortexC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarorichard%2FCortexC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alvarorichard","download_url":"https://codeload.github.com/alvarorichard/CortexC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227694853,"owners_count":17805643,"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":["binary","c","education","evaluation","intepreter","interpreter","open-source","parsing","programming-language","tokenization","zig"],"created_at":"2024-12-02T08:26:57.745Z","updated_at":"2024-12-02T08:26:58.354Z","avatar_url":"https://github.com/alvarorichard.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/alvarorichard/CortexC/assets/102667323/002eab8a-29ac-435f-a792-e58067ba79e0\" alt=\"Imagem logo\" /\u003e\n\u003c/p\u003e\n\n## Simple C Interpreter\n\n[![GitHub license](https://img.shields.io/github/license/alvarorichard/CortexC)](alvarorichard/CortexC/blob/master/LICENSE)\n![GitHub stars](https://img.shields.io/github/stars/alvarorichard/CortexC)\n![GitHub languages top](https://img.shields.io/github/languages/top/alvarorichard/CortexC)\n[![GitHub contributors](https://img.shields.io/github/contributors/alvarorichard/CortexC)](https://github.com/alvarorichard/CortexC/graphs/contributors)\n[![CI](https://github.com/vitorcarvalho67/TSLibraryAPI/workflows/CI/badge.svg)](https://github.com/alvarorichard/CortexC/actions)\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/alvarorichard/CortexC)](https://github.com/alvarorichard/CortexC/commit/main)\n![GitHub last commit](https://img.shields.io/github/last-commit/alvarorichard/CortexC)\n\nThis repository contains a simple interpreter for a subset of the C language, written in C itself. It includes a tokenizer, a parser, and an evaluator for assembly instructions. The interpreter is capable of interpreting and running simple C programs, but it does not support all features of the C language.\n\n## Overview \nThe interpreter is divided into several parts:\n\n* Definitions and Enumerations: The code starts with the definition of several constants and structures that are used throughout the program. It also defines a number of enumerations that represent different types of tokens that can be encountered in the input code.\n\n* Tokenization: The next() function is responsible for tokenizing the input code. It reads characters from the input and classifies them into different types of tokens.\n\n* Expression Parsing: The expr() and factor() functions are used for parsing expressions in the input code. However, these functions are not fully implemented in the provided code.\n\n* Program Parsing: The program() function is responsible for parsing the entire program. It repeatedly calls the next() function to get tokens and processes them accordingly.\n\n* Evaluation: The eval() function is an interpreter for the assembly instructions. It reads and executes the instructions one by one.\n\n* Main Function: The main() function is the entry point of the program. It initializes the necessary data structures, reads the input code from a file, calls the program() function to parse the code, and finally calls the eval() function to execute the parsed code.\n\n## How to use the interpreter\n\nTo use the interpreter, you need to have a C compiler installed on your system. You can compile the interpreter itself using the following command:\n\nClone this repository and compile the interpreter using the following command:\n```bash\ngit clone https://github.com/alvarorichard/CortexC.git\n```\n\nNavigate to the directory containing the source code:\n```bash\ncd CortexC\n```\n\nCompile the source code using the following command:\n```bash\nclang main.c -lfunction_parameter -o main\n```\n\nThen, you can use the compiled interpreter to interpret and run a C program as follows:\n```bash\nzig build\n```\n\nPlease note that the interpreter is quite simple and may not support all features of the C language. Also, the code seems to be incomplete and may not work correctly as is. For example, the expr() and factor() functions are not fully implemented.\n\n## Contributing\n\nContributions are welcome! If you find a bug or want to add a new feature, feel free to create a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarorichard%2Fcortexc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falvarorichard%2Fcortexc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarorichard%2Fcortexc/lists"}