{"id":19276155,"url":"https://github.com/pandeykartikey/goto","last_synced_at":"2025-11-03T11:02:55.799Z","repository":{"id":57663597,"uuid":"223557218","full_name":"pandeykartikey/goto","owner":"pandeykartikey","description":"Goto is an interpreted programming language written in go.","archived":false,"fork":false,"pushed_at":"2020-06-29T12:40:59.000Z","size":1696,"stargazers_count":80,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-21T23:36:05.115Z","etag":null,"topics":["golang","interpreter","programming-language","repl","scripting"],"latest_commit_sha":null,"homepage":"","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/pandeykartikey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-23T08:34:33.000Z","updated_at":"2024-11-27T18:49:36.000Z","dependencies_parsed_at":"2022-09-16T19:11:35.590Z","dependency_job_id":null,"html_url":"https://github.com/pandeykartikey/goto","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pandeykartikey/goto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandeykartikey%2Fgoto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandeykartikey%2Fgoto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandeykartikey%2Fgoto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandeykartikey%2Fgoto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pandeykartikey","download_url":"https://codeload.github.com/pandeykartikey/goto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandeykartikey%2Fgoto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282445596,"owners_count":26670239,"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","status":"online","status_checked_at":"2025-11-03T02:00:05.676Z","response_time":108,"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":["golang","interpreter","programming-language","repl","scripting"],"created_at":"2024-11-09T20:53:00.831Z","updated_at":"2025-11-03T11:02:55.775Z","avatar_url":"https://github.com/pandeykartikey.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Goto\n\u003e Goto is an interpreted programming language written in go.\n\n[![License: MIT](http://img.shields.io/github/license/pandeykartikey/goto.svg)](https://github.com/pandeykartikey/goto/blob/master/LICENSE.md) [![Go Report Card](https://goreportcard.com/badge/github.com/pandeykartikey/goto)](https://goreportcard.com/report/github.com/pandeykartikey/goto) [![Release](http://img.shields.io/github/v/release/pandeykartikey/goto.svg)](https://github.com/pandeykartikey/goto/releases/latest)\n\n## 1. Overview\nGoto is a dynamically typed programming language written to support all the scripting requirements. It currently supports the following:\n- Data Types: `integer`, `boolean`, `string`\n- Data Structures: `list`\n- Arithimetic Operations: `+`, `-`, `*`, `/`, `%`, `**`\n- Comparisons: `==`, `!=`, `\u003c`, `\u003c=`, `\u003e`, `\u003e=` \n- Logical Operators:  `!`, `\u0026\u0026`, `||` \n- If-Else-If Statements\n- For loops\n- Control Flow Statements `continue`, `break`, `return`\n- Multiple Assigments\n- Operator Precedence Parsing\n- Grouped Expressions\n- Functions\n- Scopes\n- Comments\n- Error Handling\n- Built in Functions: `append`, `print`, `len`\n\n## 2. Table of Content\n  - [1. Overview](#1-overview)\n  - [2. Table of Content](#2-table-of-content)\n  - [3. Installation](#3-installation)\n    - [Source Installation](#source-installation)\n    - [Binary Releases](#binary-releases)\n  - [4. Usage](#4-usage)\n  - [5. Syntax](#5-syntax)\n    - [5.1 Definitions](#51-definitions)\n      - [5.1.1 Multiple Assignments](#511-multiple-assignments)\n      - [5.1.2 Scoping](#512-scoping)\n    - [5.2 Arithmetic operations](#52-arithmetic-operations)\n    - [5.3 Lists](#53-lists)\n      - [5.3.1 Indexing](#531-indexing)\n    - [5.4 Builtin functions](#54-builtin-functions)\n    - [5.5 Functions](#55-functions)\n      - [5.5.1 Local Functions](#551-local-functions)\n    - [5.6 If-else statements](#56-if-else-statements)\n    - [5.7 For-loop statements](#57-for-loop-statements)\n    - [5.8 Control flow statements](#58-control-flow-statements)\n  - [6. Contributing](#6-contributing)\n  - [7. Acknowledgments](#7-acknowledgments)\n  - [8. License](#8-license)\n  - [9. Contact](#9-contact)\n\n\n## 3. Installation\n\n### Source Installation\nTo install `goto`, run the following command:   \n\n    go get -u github.com/pandeykartikey/goto\n\n### Binary Releases\n\nAlternatively, you could install a binary-release, from the [release page](https://github.com/pandeykartikey/goto/releases).\n\n## 4. Usage\nTo execute a goto-script, pass the name to the interpreter:\n\n    $ goto sample.to\n\nScripts can be made executable by adding a suitable shebang line:\n\n    #!/usr/bin/env goto\n\n\nTo drop into goto-repl, type `goto`. To exit from repl, just type `exit` or `Ctrl + D`.\n\n## 5. Syntax\n\n### 5.1 Definitions\nVariables are defined using the `var` keyword, with each line ending with `;`.\n\n    var a = 3;\n\nA variable must be declared before its usage. It is not necessary to provide a value while declaring a variable.\n\n    var a;\n\n#### 5.1.1 Multiple Assignments\nGoto supports multiple assignments and declarations.\n\n    var a,b,c = 1,2,3;\n\nThe datatypes of all the variables need not be the same.\n\n    a,b = 1,true;\n\n#### 5.1.2 Scoping\nGoto supports hiding of global variable in block constructs\n\n    var a = 4;\n    if true { var a = 5; print(a);} # prints 5\n    print(a); # prints 4\n\n\n### 5.2 Arithmetic operations\nGoto supports all the basic arithmetic operations along with `**` operator for power. (Inspired from Python)\n\n    square = b**2;\n    remainder = b%2;\n\n### 5.3 Lists\nList is a data structure that organizes items by linear sequence. It can hold multiple types.\n\n    var a = [1, true, \"array\"];\n\n#### 5.3.1 Indexing\nLists are 0-indexed. Elements can be accessed using []. Similar indexing exists for strings.\n\n    var a = [1, true, \"array\"];\n    a[1] # returns true\n    a[2][3] # returns \"a\"\n\n### 5.4 Builtin functions\nGoto currently supports 3 built-in functions:\n1. `len`: Returns the length of string or a list.\n\n    len(\"goto\") # returns 4\n\n2. `append`: appends a token at the end of an array\n\n    var a = [1, 2];\n    append(a, 3) # a becomes [1, 2, 3]\n\n3. `print`: prints the content of parameters to STDOUT. It can take multiple arguments.\n\n    print(1, 2, \"goto\")\n    Output: 1\n            2\n            goto\n\n### 5.5 Functions\nGoto defines function using `func` followed by an identifier and a parameter list.\n\n    func identity(x) {\n\t    return x;\n    }\n\n#### 5.5.1 Local Functions\nYou can define local functions inside a block statement with limited scope.\n\n    func addTwo(x) {\n      func addOne(x) { # addOne() is limited to addTwo()'s scope\n        return x + 1;\n      }\n      x = addOne(x);\n      return addOne(x);\n    }\n\n\n\n### 5.6 If-else statements\nGoto supports if-else-if statements.\n    \n    var a,b,c = 1,2,3;\n    if a \u003e b { \n      c = a + b; \n    } else if a \u003c c {\n      c = 20; \n    } else {\n      c = 30; \n    }\n    print(c); # returns 20\n\n### 5.7 For-loop statements\nGoto has supports for-loop statements.\n\n    for var i = 0; i \u003c 10; i = i + 1 {\n       i = i + 2;\n       print(i);\n    }\n\nAll the three initialization, condition, and update are optional in for loop.\n\n    for ;; {\n       i = i + 2;\n       print(i);\n    }\n\n### 5.8 Control flow statements\nThere are three control flow statements in goto:\n\n1. `continue`: It skips all the following statements in a for loop and moves on to the next iteration.\n\n2. `break`: It is used to break a for loop.\n\n3. `return`: It is used to terminate a function. It may also be used to return values from functions.  \n\n### 5.9 Comments\nSingle Line comments are supported by goto.\n\n    # This is a comment\n\n## 6. Contributing\nIf you spot anything that seems wrong, please do [report an issue](https://github.com/pandeykartikey/goto/issues/new).\n\nIf you feel something is missing in goto, consider creating an [issue](https://github.com/pandeykartikey/goto/issues/new) or submitting a [pull request](https://github.com/pandeykartikey/goto/pulls).\n\n## 7. Acknowledgments\nThis programming language takes inspiration from the book [Write an Interpreter in Go](https://interpreterbook.com).\n\n## 8. License\nGoto is licensed under [MIT License](https://github.com/pandeykartikey/goto/blob/master/LICENSE.md).\n\n## 9. Contact\nIf you have any queries regarding the project or just want to say hello, feel free to drop a mail at pandeykartikey99@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandeykartikey%2Fgoto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpandeykartikey%2Fgoto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandeykartikey%2Fgoto/lists"}