{"id":19536508,"url":"https://github.com/roneetkumar/simple-lang","last_synced_at":"2026-06-19T10:31:47.341Z","repository":{"id":127577405,"uuid":"262220383","full_name":"roneetkumar/simple-lang","owner":"roneetkumar","description":"Simple is a programming language based on GO lang as a base language. The objective to create this language is not only to learn GO lang but also to understand the journey of idea from source code to a finished product.","archived":false,"fork":false,"pushed_at":"2020-05-08T04:11:50.000Z","size":149,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-20T10:07:16.307Z","etag":null,"topics":["compiler","evaluator","go","go-lang","interpretor","lexer","parser"],"latest_commit_sha":null,"homepage":"https://simple-lang.herokuapp.com/","language":"Go","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/roneetkumar.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,"publiccode":null,"codemeta":null}},"created_at":"2020-05-08T03:44:03.000Z","updated_at":"2023-01-29T03:56:40.000Z","dependencies_parsed_at":"2023-08-16T20:07:30.033Z","dependency_job_id":null,"html_url":"https://github.com/roneetkumar/simple-lang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/roneetkumar/simple-lang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roneetkumar%2Fsimple-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roneetkumar%2Fsimple-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roneetkumar%2Fsimple-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roneetkumar%2Fsimple-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roneetkumar","download_url":"https://codeload.github.com/roneetkumar/simple-lang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roneetkumar%2Fsimple-lang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34528134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["compiler","evaluator","go","go-lang","interpretor","lexer","parser"],"created_at":"2024-11-11T02:23:08.555Z","updated_at":"2026-06-19T10:31:47.305Z","avatar_url":"https://github.com/roneetkumar.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple\n\n## A Programming Language - Made with **GO**\n\n### Introduction\n\n*Simple* is a  programming language based on *GO lang* as a base language.\nThe objective to create this language is not only to learn GO lang but also to understand the journey of *idea* from *source code* to a *finished product*.\n\n---\n\n### **Lexical Elements**\n\n#### **Variables**\n\nA variable is a storage location for holding a value.\n\n```js\n// Bind values to names with let-statements\n\nlet version = 1;\nlet name = \"Simple programming language\";\nlet myArray = [1, 2, 3, 4, 5];\nlet coolBooleanLiteral = true;\nlet add = fn(){}\n```\n\n#### **Use expressions to produce values**\n\n```js\nlet awesomeValue = (10 / 2) * 5 + 30;\nlet arrayWithValues = [1 + 1, 2 * 2, 3];\n```\n\n#### `;` - semicolon\n\nThe formal grammar uses semicolons `;` as terminators in a number of productions. Go programs may omit most of these semicolons using the following two rules:\n\n- When the input is broken into tokens, a semicolon is automatically inserted into the token stream immediately after a line's final token if that token is\n- an identifier\n- an integer, floating-point or string literal\n- one of the operators and punctuation `++`, `--`, `)`, `]`, or `}`\n- To allow complex statements to occupy a single line, a semicolon may\nbe omitted before a closing `)` or `}`.\n- indentifier - name program entities such as variables and types `identifier = letter { letter | unicode_digit }`\n\n#### **Operators**\n\n- **Precedence**\n\n```js\nPrecedence    Operator\n5             *  /  %\n4             +  -\n3             ==  !=  \u003c  \u003c=  \u003e  \u003e=\n2             \u0026\u0026\n1             ||\n```\n\n`x / y * z` is same as `(x / y) * z`\n\n- **Arthematic**\n\n```js\n+    sum                    integers, floats, strings\n-    difference             integers, floats\n*    product                integers, floats\n/    quotient               integers, floats\n%    remainder              integers\n```\n\n- **Comparison**\n\nComparison operators compare two operands and yield an boolean value.\n\n```js\n\n==    equal\n!=    not equal\n\u003c     less\n\u003c=    less or equal\n\u003e     greater\n\u003e=    greater or equal\n\n```\n\n- **Logical**\n\nLogical operators apply to boolean values and yield a result of the same type as the operands. The right operand is evaluated conditionally.\n\n```js\n\u0026\u0026    conditional AND    p \u0026\u0026 q  is  \"if p then q else false\"\n||    conditional OR     p || q  is  \"if p then true else q\"\n!     NOT                !p      is  \"not p\"\n```\n\n#### **Keywords**\n\n`fn` - is a built in keyword to declare a function in the program.\n\n```js\nfn(){}\nfn(x int) { return int}\nfn(a, b ,z) { return bool }\nfn(n){ return task(p) }\n```\n\n`let` - is used of bind a name with the value or expression\n\n```js\nlet a = 5;\nlet a = a + 6\nlet add = task ()\n```\n\n- `true`\n- `false`\n- `if`\n- `else`\n- `elseif`\n- `return`\n\n#### **Types**\n\n```js\n\n- `int` - the set of all signed 32-bit integers (-2147483648 to 2147483647)\n- `float` - the set of all IEEE-754 32-bit floating-point numbers\n- `char`\n- `string`\n```\n\n```js\n\n// Here is an array containing two hashes, that use strings as keys and integers\n// and strings as values\nlet people = [{\"name\": \"Anna\", \"age\": 24}, {\"name\": \"Bob\", \"age\": 99}];\n\n// Getting elements out of the data types is also supported.\n// Here is how we can access array elements by using index expressions:\nfibonacci(myArray[4]);\n// =\u003e 5\n\n// We can also access hash elements with index expressions:\nlet getName = fn(person) { person[\"name\"]; };\n\n// And here we access array elements and call a function with the element as\n// argument:\ngetName(people[0]); // =\u003e \"Anna\"\ngetName(people[1]); // =\u003e \"Bob\"\n\n```\n\n#### Define a fibonacci function\n\n```js\nlet fibonacci = fn(x) {\n  if (x == 0) {\n    0                // Simple supports implicit returning of values\n  } else {\n    if (x == 1) {\n      return 1;      // ... and explicit return statements\n    } else {\n      fibonacci(x - 1) + fibonacci(x - 2); // Recursion! Yay!\n    }\n  }\n};\n```\n\n#### functions are first-class citizens, higher-order functions and pass functions around as values\n\n```js\n\n// Define the higher-order function `map`, that calls the given function `f`\n// on each element in `arr` and returns an array of the produced values.\nlet map = fn(arr, f) {\n  let iter = fn(arr, accumulated) {\n    if (len(arr) == 0) {\n      accumulated\n    } else {\n      iter(rest(arr), push(accumulated, f(first(arr))));\n    }\n  };\n\n  iter(arr, []);\n};\n\n// Now let's take the `people` array and the `getName` function from above and\n// use them with `map`.\nmap(people, getName); // =\u003e [\"Anna\", \"Bob\"]\n```\n\n#### closures\n\n```js\n\n// newGreeter returns a new function, that greets a `name` with the given\n// `greeting`.\nlet newGreeter = fn(greeting) {\n\n  return fn(name) { return (greeting + \" \" + name); }\n};\n\n// `hello` is a greeter function that says \"Hello\"\nlet hello = newGreeter(\"Hello\");\n\n// Calling it outputs the greeting:\nhello(\"dear, simple programmer!\"); // =\u003e dear, simple programmer!\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froneetkumar%2Fsimple-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froneetkumar%2Fsimple-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froneetkumar%2Fsimple-lang/lists"}