{"id":19436937,"url":"https://github.com/andresrodriguez55/interpreterforbigaddlanguage","last_synced_at":"2026-03-09T08:02:12.120Z","repository":{"id":48768851,"uuid":"385387357","full_name":"andresrodriguez55/InterpreterForBigAddLanguage","owner":"andresrodriguez55","description":"Interpreter for the BigAdd language.","archived":false,"fork":false,"pushed_at":"2021-10-11T14:10:52.000Z","size":883,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T21:51:34.199Z","etag":null,"topics":["c","compiler","interpreter"],"latest_commit_sha":null,"homepage":"https://replit.com/@andresrodrigu/PL#main.c","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andresrodriguez55.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}},"created_at":"2021-07-12T21:25:32.000Z","updated_at":"2023-02-22T19:21:39.000Z","dependencies_parsed_at":"2022-08-26T20:10:53.812Z","dependency_job_id":null,"html_url":"https://github.com/andresrodriguez55/InterpreterForBigAddLanguage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andresrodriguez55/InterpreterForBigAddLanguage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresrodriguez55%2FInterpreterForBigAddLanguage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresrodriguez55%2FInterpreterForBigAddLanguage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresrodriguez55%2FInterpreterForBigAddLanguage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresrodriguez55%2FInterpreterForBigAddLanguage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andresrodriguez55","download_url":"https://codeload.github.com/andresrodriguez55/InterpreterForBigAddLanguage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresrodriguez55%2FInterpreterForBigAddLanguage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30287447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["c","compiler","interpreter"],"created_at":"2024-11-10T15:13:03.741Z","updated_at":"2026-03-09T08:02:12.093Z","avatar_url":"https://github.com/andresrodriguez55.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Full Documentation](https://andresrodriguez55.github.io/#/post/9/Interpreter%20For%20The%20BigAdd%20Language%20Made%20With%20C)\n\n## Link\nhttps://replit.com/@andresrodrigu/PL#main.c\n\n## Contents\n\n- 1) INFORMATION\n- 2) PARSER \u0026 INTERPRETER\n   - 2.a Design of The Algorithm\n   - 2.b Memory\n   - 2.c Outs\n   - 2.e Arithmetic Operations\n   - 2.f Execution of Blocks\n- 3) USER INPUTS \u0026 INTERPRETER IMPLEMENTATION\n- 4) Test Screenshots\n   - 4.a Finding the nth Fibonacci of 101 Digits\n   - 4.b Finding The Sum of The Consecutive Numbers Squared\n   - 4.c Drawing a Right-Angled Triangle\n   - 4.d Syntax Error Example\n   - 4.e Syntax Error Example\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n## 1) INFORMATION\n\nFor the implementation of the interpreter the IDE Apache NetBeans 12.2 and Cygwin have been\nused.\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n## 2) PARSER \u0026 INTERPRETER\n\n### 2.a Design of The Algorithm\n\nFor the solution of the parser problem, it has been decided to implement the most obvious solution,\ncreate states where one can be found and be guided by them. In order to implement this, it has been\ndecided to make FSMs of any state in which we may find ourselves.\n\nNote: all the different situations that could occur (wrong situations) have not been shown in the\nFSMs due to their density. Any input other than those shown that can occur in all states except the\ninitial one will be counted as reject.\n\n![](img/3.png)\n![](img/4.png)\n![](img/5.png)\n![](img/6.png)\n![](img/7.png)\n![](img/8.png)\n\nAlso, despite the fact that we are talking about a parser, let us remember that it will play a very\nimportant role with the interpreter, because the interpreter will execute each correct line of code\nthat it sees.\n\nHaving said this we are aware that until a line of code does not finalize it will not be able to be\nexecuted, these make us think that it will be necessary to save each element read, be it strings,\nnumber values, etc...\n\nHaving said this, it has been thought to use two global variables, one of which will save the numerical\nvalues read and the other the variable name, the reason for this is because if we remember the add,\nsub and loop instructions technically use one variable and one numerical value.\n\nWe will also need a structure such that it can save the elements that are going to be printed,\nremember that there are two types of elements that can be printed, which are the structure that we\ncreated for the strings and character arrays.\n\nWe will also need a memory that stores all the variables declared by the user.\n\nFinally, I would like to emphasize the issue of loops, in the last finite state machine shown it can be\nclearly seen that loops will be a delicate situation, either due to the situations they contain or\nbecause when designing an interpreter each line must be executed of code one by one, so from now\non we can guess that we will need two functions, one that will execute the lines of code that the\nmain block contains and the other that executes a loop block.\n\nFor the errors, an encoding table will be made which is helped by the FSMs shown and the encoding\nof the stored word that could already be seen in the previous project, so the user will be notified of\nthe most exact errors possible.\n\nHaving said all this, we already know that all the functions that have to do with variables will also\nhave to be done (such as moving a value, adding, subtracting, etc...), these functions and the output\nfunctions only and will only be executed when a line of code read has been validated thanks to the\nFSMs, basically the required function will be put into operation when an end of line has been\nreached.\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n### 2.b Memory\n\nIt has been decided to design a memory that stores the variables created by the user and thus be\nable to know when the user is using a variable that he has not declared before.\n\nFor the memory design, the most obvious structure has been thought, a linked list, in which each\nnode stores the name of the variable, its value (which for now is not necessary but as it will be\nneeded in the second project from now on has done) and the next node that has to arrive.\n\nThe saved values will be of the character array type because we remember that what is read is saved\nin a character array type variable, also because this language tells us that the numbers can have a\nmaximum of one hundred digits.\n\nAlso, from now on we want to emphasize that if the user declared an existing variable, the value\nwould be reset to said variable, like Python.\n\nTo increase speed, it has been decided to design the linked list in such a way that it works the other\nway around, this is because normally whenever a variable is declared it is used at the time.\n\n![](img/9.png)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n### 2.c Outs\n\nFor the outputs a structure will be used such that it can store the elements that are going to be\nprinted, remember that there are two elements that can be printed, also remember that C does not\nhave generic data types, for this a variable will be used that tells us if the saved element is a string or\nan array of characters, to save the referred element a void type pointer will be used.\n\n![](img/10.png)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n### 2.e Arithmetic Operations\n\nIn order to give the correct results of the arithmetic operations, it has been necessary to partition the\ncases that may occur, which are the ones shown below.\n\nHaving noted these situations, the required algorithms have been designed by partitioning the\nsituations. Two functions have been made which will take two positive values, one for addition and\nthe other for subtraction. Two other functions have been made which will queue the values\nobtained, when I say strain, I mean as if you wanted to add zero to a variable, or if you wanted to\nsubtract a negative number from a variable of positive value that would actually be making a sum,\nstraining the values will be sent to the necessary functions if necessary.\n\nWe must also remember that a problem arises in the subtractions because all the operations will be\ndone manually, for example, let's say that the user wants to subtract nine hundred and ninety-eight\nto nine hundred and ninety-nine, when doing it manually we would obtain two zeros in the prefix\nwhich would not be desired, this forces us to have to write a function which would eliminate the\nunnecessary zeros from the numerical values, which will also help in reading the code, so if the user\nenters unnecessary zeros in the code they will not be taken into account.\n\nAlso remember that the problem arises that the result of a sum exceeds one hundred digits, for that\nreason, additionally this situation will also be controlled in the function of the sums.\n\n![](img/11.png)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n### 2.f Execution of Blocks\n\nThe design of the function that will execute the loops has been done in the style of unit tests, writing\ntests of all possible situations and correcting the code based on errors.\n\nI would also like to emphasize that if a negative or zero value is given for a loop, the program will also\nanalyze the code, only without yielding results of operations or outs.\n\nThe values of the loops will always be subtracted one at the end of the instruction, after the\nsubtraction if the value is not equivalent to zero (when we speak of positive values at the beginning)\nthe code will be executed again from the beginning of the point that it started.\n\n![](img/12.png)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n## 3) USER INPUTS \u0026 INTERPRETER IMPLEMENTATION\n\nFor each program execution only one script will be able to be executed.\nAs in the previous project, file names of any length can be taken.\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n## 4) Test Screenshots\n\n### 4.a Finding the nth Fibonacci of 101 Digits\n\n![](img/13.png)\n![](img/14.png)\n.                                                  .                                               .\n.                                                  .                                               .\n.                                                  .                                               .\n.                                                  .                                               .\n![](img/15.png)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n### 4.b Finding The Sum of The Consecutive Numbers Squared\n\n![](img/16.png)\n![](img/17.png)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n### 4.c Drawing a Right-Angled Triangle\n\n![](img/18.png)\n![](img/19.png)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n### 4.d Syntax Error Example\n\n![](img/20.png)\n![](img/21.png)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n### 4.e Syntax Error Example\n\n![](img/22.png)\n![](img/23.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandresrodriguez55%2Finterpreterforbigaddlanguage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandresrodriguez55%2Finterpreterforbigaddlanguage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandresrodriguez55%2Finterpreterforbigaddlanguage/lists"}