{"id":20682096,"url":"https://github.com/mohammedhrima/interpreted_programming_language","last_synced_at":"2025-04-22T12:13:39.862Z","repository":{"id":143498013,"uuid":"612869988","full_name":"mohammedhrima/Interpreted_programming_language","owner":"mohammedhrima","description":"Interpreted programming language built with C","archived":false,"fork":false,"pushed_at":"2024-04-02T05:03:02.000Z","size":18442,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T12:13:33.074Z","etag":null,"topics":["c","ccompiler","compiler","compilers","cprogramming","cprogramming-language","cproject","interpreter","programming-language","python-syntax"],"latest_commit_sha":null,"homepage":"","language":"C","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/mohammedhrima.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}},"created_at":"2023-03-12T08:16:41.000Z","updated_at":"2025-02-21T08:01:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"28a792dc-2dcc-4510-a254-b734a2307a60","html_url":"https://github.com/mohammedhrima/Interpreted_programming_language","commit_stats":null,"previous_names":["mohammedhrima/mini_programing_language","mohammedhrima/interpreted_programming_language"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedhrima%2FInterpreted_programming_language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedhrima%2FInterpreted_programming_language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedhrima%2FInterpreted_programming_language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohammedhrima%2FInterpreted_programming_language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohammedhrima","download_url":"https://codeload.github.com/mohammedhrima/Interpreted_programming_language/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237834,"owners_count":21397401,"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":["c","ccompiler","compiler","compilers","cprogramming","cprogramming-language","cproject","interpreter","programming-language","python-syntax"],"created_at":"2024-11-16T22:12:45.820Z","updated_at":"2025-04-22T12:13:39.831Z","avatar_url":"https://github.com/mohammedhrima.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"- I tried to build a mini programming language that has syntax similar to python with C\n- And redo some exercices from 42pool and Libft project with it\n- I've also borrow some attributes from javascript X'D\n- You can check the tutorial for more details\n- This project was made for fun\n- The folder /test_mini contains lot of examples, feel free to check it\n\n## How to use\n\n- installation\n+ clone the repo cd to it\n```bash\n  make\n```\n- then run command\n```bash\n  ./mini path_to_your_file.mini # create a file with .mini as extention\n```\n\n## Introduction\n#### 1- hello world\n- first hello word:\n    ```python\n    output(\"hello world\")\n    ```\n\n- comments:\n    ```c\n        // this is line of comment\n    ```\n\n    ```python\n        \"\"\"\n        this is \n        bloc of \n        comments X'D\n        \"\"\"\n    ```\n\n#### 2- data types:\n- variable declaration and data types:\n    - number:\n    ```python\n        num = 123\n        output(\"num is \", num, \"\\n\")\n    ```\n    - characters (one character or string):\n   ```python\n        str = \"hello world\"\n        output(\"str is \", str, \"\\n\")\n    ``` \n    - array:\n    ```python\n        array = [1, 2, 3, 4, 5]\n        output(\"array has value: \", array, \"\\n\")\n    ```\n    - object:\n    ```python\n        obj = {\n            stname: \"mohammed\",\n            ndname:\"hrima\",\n            age:25\n          }\n\n        output(\"obj is \", obj, \"\\n\")\n\n        // in case you want to access one of object attributes    \n        output(\"obj has stname \", obj.stname, \" and ndname \", obj.ndname, \" and age \", obj.age, \"\\n\") \n    ```\n    ps: you can split data types with comma ','  in ouput function like print does in python\n\n    - boolean:\n    ```python\n        boolean = true\n        output(\"this is boolean with value \", boolean, \"\\n\")\n        boolean = false\n        output(\"this is boolean with value \", boolean, \"\\n\")\n    ```\n    \n\n    - Wait there is something else you may need to check\n    - All data types has an attribute \"type\" that return data type name as string\n    ```python\n        output(\"str has type \", str.type, \"\\n\")\n        output(\"num has type \", num.type, \"\\n\")\n        output(\"obj has type \", obj.type, \"\\n\")\n        output(\"array has type \", array.type, \"\\n\")\n        output(\"boolean has type \", boolean.type, \"\\n\")\n    ```\n\n#### 3- take input:\n- example:\n    ```python\n        stname = input(\"Enter first name: \")\n        ndname = input(\"Enter second name: \")\n    ```\n- to output the current input: \\\n    method 1 :\n    ```python\n        output(\"Your full name is \", stname, \" \", ndname, \"\\n\")\n    ```\n    method 2:\n    ```python\n        fullname = stname + \" \" + ndname // you can use + operator to concatinate two strings\n    \n        output(\"Your full name is \", fullname, \"\\n\")\n\n        // here is another aproach\n        output(\"Your full name is \" + fullname + \"\\n\")\n    ```\n    \n- input does read input as string and assign it to left variable, in case you want to read a number,\\\n    you can use tonum attribute, and here is what to do it \n\n    ```python\n        num = input(\"Enter your birthyear \u003e \").tonum\n        output(\"Your age is: \", 2023 - num, \"\\n\")\n\n        // here is anotehr aproach\n        num1 = input(\"Enter your birthyear \u003e \")\n        output(\"Your age is: \",  2023 - num1.tonum, \"\\n\")\n    ```\n\n## Iterations and attributes\n#### 1- characters:\n- Iteration:\n    ```python\n        str = \"this is a string\"\n        output(\"str[0] is \", str[0], \"\\n\")\n    ```\n- concatination:\n    ```python\n        str1 = \"hello \"\n        str2 = \"world\"\n        output(\"str1 + str2 is \", str1 + str2)\n    ````\n- indexof:\n    ```python\n        str = \"abcdefghijklmno\"\n        output(\"index of de in str \", str.indexof(\"de\"), \"\\n\")\n        output(\"index of fe in str \", str.indexof(\"fe\"), \"\\n\") // return -1 if doesn't exist\n    ```\n- count:\n    ```python\n        str = \"abcdefgahijaklmno\"\n        output(\"there is \",str.count(\"a\"),\" a in str\", \"\\n\")\n        output(\"there is \",str.count(\"z\"),\" z in str\", \"\\n\")\n    ```\n- split:\n    ```python\n        str = \"abcdefgahijaklmno\"\n        array = str.split(\"a\")\n        output(\"array is: \", array, \"\\n\")\n    ````\n- trim:\n    ```python\n        str = \"abcdefgahijaklmnoabc\"\n        output(\"trim str by 'abc' \", str ,\"\\n\")\n        output(\"str after triming \", str.trim(\"abc\") ,\"\\n\")\n    ```\n- startswith: (return boolean value)\n    ```python\n        str = \"abcdefgahijaklmnoabc\"\n        output(str.startswith(\"abc\") ,\"\\n\")\n        output(str.startswith(\"abce\") ,\"\\n\")\n    ```\n- endswith: (return boolean value)\n    ```python\n        str = \"abcdefgahijaklmno\"\n        output(str.endswith(\"mno\") ,\"\\n\")\n        output(str.endswith(\"mnop\") ,\"\\n\")\n    ```\n- toupper:\n    ```python\n        str = \"abcdefg\"\n        output(\"to upper: \", str.toup, \"\\n\")\n    ```\n- tolower:\n    ```python\n        str = \"RSTUVWX\"\n        output(\"to low: \", str.tolow, \"\\n\\n\")\n    ```\n- tonumber:\n    ```python\n        str = \"123\"\n        output(str.tonum, \"\\n\\n\")\n    ```\n- isupper:\n    ```python\n        str = \"ABC\"\n        output(str.isup, \"\\n\\n\")     \n    ```\n- islower:\n    ```python\n        str = \"abc\"\n        output(str.islow, \"\\n\\n\")\n    ```\n- ischaracter:\n    ```python\n        str = \"abc\"\n        output(str.ischar, \"\\n\\n\")\n    ```\n- isnum:\n    ```python\n        str = \"123\"\n        output(str.isnum, \"\\n\\n\")\n    ```\n- len:\n    ```python\n        str = \"abcdefgi\"\n        output(str.len, \"\\n\\n\")\n    ```\n- type:\n    ```python\n        str = \"abcd\"\n        output(str.type, \"\\n\\n\")\n    ```\n\n#### 2- number:\n- base:\n    ```python\n        n = 10\n        output(\"n in base 10 is: \", n.base(\"0123456789\"), \"\\n\")\n        output(\"n in base 16 is: \", n.base(\"0123456789ABCDEF\"), \"\\n\")\n        output(\"n in base 2 is: \", n.base(\"01\"), \"\\n\")\n    ```\n- tocharacter:\n    ```python\n        output(\"n to characters \", n.tochar,\"\\n\")\n    ```\n- type:\n    ```python\n        output(n.type, \"\\n\")\n    ```\n#### 3- array:\n- iteration:\n    ```python\n        array = [\"h\", \"e\", \"l\", \"l\", \"o\", \"\\n\"]\n        output(\"array[0] is \", array[0], \"\\n\")\n    ````\n- concatination:\n    ```python\n        array1 = [1,2,3]\n        array2 = [4,5,6]\n        array3 = array1 + array2\n        output(\"array1 + array2 is \", array3)\n    ```\n- indexof:\n    ```python\n        array = [11,22,33]\n        output(\"index of 22 in array \", array.indexof(22), \"\\n\")\n    ```\n- count:\n    ```python\n        array = [11,22,33, 44, 55, 11, 22, 33, 11]\n        output(\"there is \",array.count(11),\" 11 in array\", \"\\n\")\n    ```\n- len:\n    ```python\n        array = [11,22,33, 44, 55, 11, 22, 33, 11]\n        output(array.len, \"\\n\")\n    ```\n- type:\n    ```python\n        array = [11,22,33, 44, 55, 11, 22, 33, 11]\n        output(array.type, \"\\n\")\n    ```\n\n#### 4- boolean:\n- type:\n    ```python\n        value = true\n        value = false\n        output(value.type, \"\\n\")\n    ```\n\n#### 5- object:\n- you can access object values by there keys:\n    ```python\n        obj = {\n                name: \"mohammed\",\n                age: 25\n              }\n        output(obj, \"\\n\")\n        output(\"obj has name: \", obj.name, \" and age \", obj.age,\"\\n\")\n        output(\"obj name has len \", obj.name.len,\"\\n\")\n    ```\n\n## Logic operator\n#### 1- equality:\n- to check if two strings are the stname\n    ```python\n        str1 = \"abcdef\"\n        str2 = \"abcdef\"\n    ```\n- method 1:\n    ```python\n        res = str1 == str2\n        output(\"1st method: check if str1 is same as str2: \", res, \"\\n\")\n    ```\n- method 2:\n    ```python\n        res = str1 is str2\n        output(\"2nd method: check if str1 is same as str2: \", res, \"\\n\")\n    ```\n    ```python\n        x = 1\n        y = 12\n        output(\"check if x is equal to y: \", x == y, \"\\n\")\n    ```\n#### 2- comparision:\n- examples:\n    ```python\n        res = 6 \u003c 66\n        output(\"check if 6 is less than 66: \", res, \"\\n\")\n    ```\n    ```python\n        x = 1\n        y = 12\n        output(\"check if x is equal to y: \", x \u003c y, \"\\n\")\n    ```\n#### 3- and or:\n- examples:\n    - and:\n    ```python\n        res = 0 \u003c 1 and 1 \u003c 2\n        output(\"test 'and': \", res, \"\\n\")\n    ```\n    ```python\n        res = 10 \u003c 1 \u0026\u0026 1 \u003c 2\n        output(\"test '\u0026\u0026': \", res, \"\\n\")\n    ```\n    - or:\n    ```python\n        res = 10 \u003c 1 or 1 \u003c 2\n        output(\"test 'or': \", res, \"\\n\")\n    ```\n    ```python\n        res = 10 \u003c 1 || 1 \u003c 2\n        output(\"test '||': \", res, \"\\n\")\n    ```\n\n## Loops and statements:\n#### 1- if statament:\n- examples:\n    ```python\n        x = 10\n        if x % 2 == 0:\n            output(\"is odd\\n\")\n        else:\n            output(\"is even\\n\")\n    ```\n    ```python\n        y = -10\n        if y == 0:\n            output(\"is zero\\n\")\n        elif y \u003e 0:\n            output(\"is more than zero\\n\")\n        else:\n            output(\"is less than zero\\n\")\n    ```\n#### 2- while loop:\n- examples:\n    ```python\n        x = 0\n        while x \u003c 10:\n            output(\"increment x: \", x ,\"\\n\")\n            x += 1\n    ```\n    ```python\n        y = 10\n        while y \u003e 0:\n            output(\"decrement y: \", y, \"\\n\")\n            y -= 1\n    ```\n#### 3- for loop:\n- examples:\n    ```python\n        array = [11,22,33,44,55]\n        for x in range(0, array.len):\n            output(\"array[\",x, \"] is \", array[x], \"\\n\")\n    ```\n    - range function: return array of number \n    ```python\n        range(0, 10) // return [0,1,2,3,4,6,7,8,9]\n        range(10, 0) // return [10,9,8,7,6,5,4,3,2,1]\n    ```\n    - you can use 'in' keyword to iterate over array:\n     ```python\n        array = [11,22,33,44,55]\n        for x in range(0, array.len):\n            output(\"array[\",x, \"] is \", array[x], \"\\n\")\n    ```\n    - to iterate over string with for loop\n    ```python\n        str = \"abcdefghijklmnop\"\n        for z in range(str.len - 1, 0):\n            output(\"str[\",z,\"] is \", str[z], \"\\n\")\n    ```\n\n## Functions:\n- examples:\n    ```python\n        func sayHi(str):\n            output(\"hello \",str, \"\\n\")\n\n        sayHi(\"Kidoo\")\n    ```\n    - return keyword:\n    ```python\n        func add(x,y):\n            return x + y\n\n        output(\"2 + 5 is \", add(2, 5), \"\\n\")\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohammedhrima%2Finterpreted_programming_language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohammedhrima%2Finterpreted_programming_language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohammedhrima%2Finterpreted_programming_language/lists"}