{"id":26022839,"url":"https://github.com/junnishimura/jsop","last_synced_at":"2026-04-25T03:09:08.314Z","repository":{"id":257825730,"uuid":"859404050","full_name":"JunNishimura/JSOP","owner":"JunNishimura","description":"Let's write programs in JSON!!","archived":false,"fork":false,"pushed_at":"2024-10-16T16:33:49.000Z","size":181,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-19T09:06:24.725Z","etag":null,"topics":["go","json","programming-language"],"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/JunNishimura.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":"2024-09-18T15:49:44.000Z","updated_at":"2024-10-17T14:48:26.000Z","dependencies_parsed_at":"2024-10-18T03:33:25.913Z","dependency_job_id":null,"html_url":"https://github.com/JunNishimura/JSOP","commit_stats":null,"previous_names":["junnishimura/jsop"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JunNishimura%2FJSOP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JunNishimura%2FJSOP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JunNishimura%2FJSOP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JunNishimura%2FJSOP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JunNishimura","download_url":"https://codeload.github.com/JunNishimura/JSOP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242194218,"owners_count":20087533,"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":["go","json","programming-language"],"created_at":"2025-03-06T10:37:07.727Z","updated_at":"2026-04-25T03:09:08.270Z","avatar_url":"https://github.com/JunNishimura.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align='center'\u003e\n  \u003ch1\u003eJSOP\u003c/h1\u003e\n  \u003ch3\u003ewrite program in JSON\u003c/h3\u003e\n\u003c/div\u003e\n\n\u003cp align='center'\u003e\n  \u003cimg alt=\"GitHub release (latest by date)\" src=\"https://img.shields.io/github/v/release/JunNishimura/JSOP\"\u003e\n  \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/JunNishimura/JSOP\"\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/JunNishimura/jsop\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/JunNishimura/jsop\" alt=\"Go Report Card\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n```json\n{\n    \"command\": {\n      \"symbol\": \"print\",\n      \"args\": \"Hello, World!\"\n    }\n}\n```\n\n## 💾 Installation\n### Homebrew Tap\n```\nbrew install JunNishimura/tap/JSOP\n```\n\n### go intall\n```\ngo install github.com/JunNishimura/jsop@latest\n```\n\n### GitHub Releases\nDownload exec files from [GitHub Releases](https://github.com/JunNishimura/JSOP/releases).\n\n## 💾 How to use\nSince REPL is not provided, you can write your program in any file and pass the file path as a command line argument to execute the program.\n\n```bash\njsop ./path/to/file.jsop.json\n```\n\n## 📖 Language Specification\n1. Everything is an expression.\n2. Only `.jsop` and `.jsop.json` are accepted as file extensions.\n\n### Integer\nInteger value is a sequence of numbers.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n123\n```\n\u003c/details\u003e\n\n### String\nString value is a sequence of letters, symbols, and spaces enclosed in double quotation marks.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n\"this is a string\"\n```\n\u003c/details\u003e\n\n### Boolean\nBoolean value is either `true` or `false`.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\ntrue\n```\n\u003c/details\u003e\n\n### Array\nArrays are composed of expressions.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n[1, \"string\", true]\n```\n\u003c/details\u003e\n\n### Identifiers\nStrings beginning with the `$` symbol are considered as identifiers.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n  \n```json\n\"$x\"\n```\n\u003c/details\u003e\n\nEmbedding the Identifier in a string is accomplished by using curly brackets.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n  \n```json\n\"{$hello}, world!\"\n```\n\u003c/details\u003e\n\n### Assignment\nTo assign a value or function to an identifier, use the `set` key. \n| parent key | children key | explanation |\n| ---- | ---- | ---- |\n| set |  | declaration of assignment |\n|  | var | identifier name |\n|  | val | value to assign |\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n[\n    {\n        \"set\": {\n            \"var\": \"$x\",\n            \"val\": 10\n        }\n    },\n    \"$x\"\n]\n```\n\u003c/details\u003e\n\n### Function\n#### Function Definition\nFunctions can be defined by using `set` key and `lambda` expression`.\n| parent key | children key | explanation |\n| ---- | ---- | ---- |\n| lambda |  | declaration |\n|  | params | parameters(optional) |\n|  | body | body of function |\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n{\n    \"set\": {\n        \"var\": \"$add\",\n        \"val\": {\n            \"lambda\": {\n                \"params\": [\"$x\", \"$y\"],\n                \"body\": {\n                    \"command\": {\n                        \"symbol\": \"+\",\n                        \"args\": [\"$x\", \"$y\"]\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\u003c/details\u003e\n\n#### Function Call\nFunctions can be called by using `command` key.\n| parent key | children key | explanation |\n| ---- | ---- | ---- |\n| command |  | declaration of function calling |\n|  | symbol | function to call |\n|  | args | arguments(optional) |\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n{\n    \"command\": {\n        \"symbol\": \"+\",\n        \"args\": [1, 2]\n    }\n}\n```\n\u003c/details\u003e\n\n### Builtin Functions\nBuiltin functions are as follows,\n| 関数 | explanation |\n| ---- | ---- |\n| + | addition |\n| - | subtraction |\n| * | multiplication |\n| / | division |\n| % | modulo |\n| ! | negation |\n| \u0026\u0026 | and operation |\n| \\|\\| | or operation |\n| == | equation |\n| != | non equation |\n| \u003e | greater than |\n| \u003e= | greater than equal |\n| \u003c | smaller than |\n| \u003e= | smaller than equal |\n| print | print to standard output |\n| len | length of array |\n| at | access to the element of array |\n\n### If\nConditional branches can be implemented by using the `if` key.\n| parent key | children key | explanation |\n| ---- | ---- | ---- |\n| if |  | declaratoin of if |\n|  | cond | condition |\n|  | conseq | consequence(the program to execute when cond is true) |\n|  | alt | alternative(the program to execute when cond is false) |\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n{\n    \"if\": {\n        \"cond\": {\n            \"command\": {\n                \"symbol\": \"==\",\n                \"args\": [1, 2]\n            }\n        },\n        \"conseq\": {\n            \"command\": {\n                \"symbol\": \"+\",\n                \"args\": [3, 4]\n            }\n        },\n        \"alt\": {\n            \"command\": {\n                \"symbol\": \"*\",\n                \"args\": [5, 6]\n            }\n        }\n    }\n}\n```\n\u003c/details\u003e\n\n### Loop\nIterations are handled by using the `loop` key.\n| parent key | children key | explanation |\n| ---- | ---- | ---- |\n| loop |  | declaration of loop |\n|  | for | the identifier for loop counter |\n|  | from | the initial value of loop counter |\n|  | until | loop termination condition (break when loop counter equals this value) |\n|  | do | Iterative processing body |\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n{\n    \"loop\": {\n        \"for\": \"$i\",\n        \"from\": 0,\n        \"until\": 10,\n        \"do\": {\n            \"command\": {\n                \"symbol\": \"print\",\n                \"args\": \"$i\"\n            }\n        }\n    }\n}\n```\n\u003c/details\u003e\n\nYou can also perform a loop operation on the elements of an Array. Unlike the example above, the `in` key specifies an Array.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n[\n    {\n        \"set\": {\n            \"var\": \"$arr\",\n            \"val\": [10, 20, 30]\t\n        }\n    },\n    {\n        \"loop\": {\n            \"for\": \"$element\",\n            \"in\": \"$arr\",\n            \"do\": {\n                \"command\": {\n                    \"symbol\": \"print\",\n                    \"args\": \"$element\"\n                }\n            }\n        }\n    }\n]\n```\n\u003c/details\u003e\n\nAlso, insert `break` and `continue` as keys as follows.\n```json\n[\n    {\n        \"set\": {\n            \"var\": \"$sum\",\n            \"val\": 0\n        }\n    },\n    {\n        \"loop\": {\n            \"for\": \"$i\",\n            \"from\": 1,\n            \"until\": 15,\n            \"do\": {\n                \"if\": {\n                    \"cond\": {\n                        \"command\": {\n                            \"symbol\": \"\u003e\",\n                            \"args\": [\"$i\", 10]\n                        }\n                    },\n                    \"conseq\": {\n                        \"break\": {}\n                    },\n                    \"alt\": {\n                        \"if\": {\n                            \"cond\": {\n                                \"command\": {\n                                    \"symbol\": \"==\",\n                                    \"args\": [\n                                        {\n                                            \"command\": {\n                                                \"symbol\": \"%\",\n                                                \"args\": [\"$i\", 2]\n                                            }\n                                        },\n                                        0\n                                    ]\n                                }\n                            },\n                            \"conseq\": {\n                                \"set\": {\n                                    \"var\": \"$sum\",\n                                    \"val\": {\n                                        \"command\": {\n                                            \"symbol\": \"+\",\n                                            \"args\": [\"$sum\", \"$i\"]\n                                        }\n                                    }\n                                }\n                            },\n                            \"alt\": {\n                                \"continue\": {}\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    },\n    \"$sum\"\n]\n```\n\n### Retrun\nUse `return` key when you exit the program with return.\n```json:return.jsop.json\n[\n    {\n        \"set\": {\n            \"var\": \"$f\",\n            \"val\": {\n                \"lambda\": {\n                    \"body\": [\n                        {\n                            \"set\": {\n                                \"var\": \"$sum\",\n                                \"val\": 0\n                            }\n                        },\n                        {\n                            \"loop\": {\n                                \"for\": \"$i\",\n                                \"from\": 1,\n                                \"until\": 11,\n                                \"do\": {\n                                    \"if\": {\n                                        \"cond\": {\n                                            \"command\": {\n                                                \"symbol\": \"\u003e\",\n                                                \"args\": [\"$i\", 5]\n                                            }\n                                        },\n                                        \"conseq\": {\n                                            \"return\": \"$sum\"\n                                        },\n                                        \"alt\": {\n                                            \"set\": {\n                                                \"var\": \"$sum\",\n                                                \"val\": {\n                                                    \"command\": {\n                                                        \"symbol\": \"+\",\n                                                        \"args\": [\"$sum\", \"$i\"]\n                                                    }\n                                                }\n                                            }\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    ]\n                }\n            }\n        }\n    },\n    {\n        \"command\": {\n            \"symbol\": \"$f\"\n        }\n    }\n]\n```\n\n### Macro\nMacro can be defined by using `defmacro` key.\n| parent key | children key | explanation |\n| ---- | ---- | ---- |\n| defmacro |  | declaration of macro definition |\n|  | name | name of macro |\n|  | keys | keys |\n|  | body | the body of macro |\n\nYou can also call the `quote` symbol for quoting, and unquote by adding backquotes to the beginning of the string.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n{\n    \"defmacro\": {\n        \"name\": \"unless\",\n        \"keys\": [\"cond\", \"conseq\", \"alt\"],\n        \"body\": {\n            \"command\": {\n                \"symbol\": \"quote\",\n                \"args\": {\n                    \"if\": {\n                        \"cond\": {\n                            \"command\": {\n                                \"symbol\": \"!\", \n                                \"args\": \",cond\"\n                            }\n                        },\n                        \"conseq\": \",conseq\",\n                        \"alt\": \",alt\"\n                    }\n                }\n            } \n        }\n    }\n}\n```\n\u003c/details\u003e\n\nDefining function can be much simpler if you use Macro.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n[\n    {\n        \"defmacro\": {\n            \"name\": \"defun\",\n            \"keys\": [\"name\", \"params\", \"body\"],\n            \"body\": {\n                \"command\": {\n                    \"symbol\": \"quote\",\n                    \"args\": {\n                        \"set\": {\n                            \"var\": \",name\",\n                            \"val\": {\n                                \"lambda\": {\n                                    \"params\": \",params\",\n                                    \"body\": \",body\"\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    },\n    {\n        \"defun\": {\n            \"name\": \"$add\",\n            \"params\": [\"$x\", \"$y\"],\n            \"body\": {\n                \"command\": {\n                    \"symbol\": \"+\",\n                    \"args\": [\"$x\", \"$y\"]\n                }\n            }\n        }\n    },\n    {\n        \"command\": {\n            \"symbol\": \"$add\",\n            \"args\": [1, 2]\n        }\n    }\n]\n```\n\u003c/details\u003e\n\n### Comment\nComments can be inesrted by using `//` key.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n{\n    \"//\": \"this is a function to add two values\",\n    \"set\": {\n        \"var\": \"$add\",\n        \"val\": {\n            \"lambda\": {\n                \"params\": [\"$x\", \"$y\"],\n                \"body\": {\n                    \"command\": {\n                        \"symbol\": \"+\",\n                        \"args\": [\"$x\", \"$y\"]\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\u003c/details\u003e\n\n## 🤔 FizzBuzz Problem\nFinally, I have included an example of solving a FizzBuzz problem in JSOP.\n\u003cdetails open\u003e\u003csummary\u003eExample\u003c/summary\u003e\n\n```json\n[\n    {\n        \"set\": {\n            \"var\": \"$num\",\n            \"val\": 31\n        }\n    },\n    {\n        \"loop\": {\n            \"for\": \"$i\",\n            \"from\": 1,\n            \"until\": \"$num\",\n            \"do\": {\n                \"if\": {\n                    \"cond\": {\n                        \"command\": {\n                            \"symbol\": \"\u0026\u0026\",\n                            \"args\": [\n                                {\n                                    \"command\": {\n                                        \"symbol\": \"==\",\n                                        \"args\": [\n                                            {\n                                                \"command\": {\n                                                    \"symbol\": \"%\",\n                                                    \"args\": [\"$i\", 3]\n                                                }\n                                            },\n                                            0\n                                        ]\n                                    }\n                                },\n                                {\n                                    \"command\": {\n                                        \"symbol\": \"==\",\n                                        \"args\": [\n                                            {\n                                                \"command\": {\n                                                    \"symbol\": \"%\",\n                                                    \"args\": [\"$i\", 5]\n                                                }\n                                            },\n                                            0\n                                        ]\n                                    }\n                                }\n                            ]\n                        }\n                    },\n                    \"conseq\": {\n                        \"command\": {\n                            \"symbol\": \"print\",\n                            \"args\": \"{$i}: FizzBuzz\"\n                        }\n                    },\n                    \"alt\": {\n                        \"if\": {\n                            \"cond\": {\n                                \"command\": {\n                                    \"symbol\": \"==\",\n                                    \"args\": [\n                                        {\n                                            \"command\": {\n                                                \"symbol\": \"%\",\n                                                \"args\": [\"$i\", 3]\n                                            }\n                                        },\n                                        0\n                                    ]\n                                }\n                            },\n                            \"conseq\": {\n                                \"command\": {\n                                    \"symbol\": \"print\",\n                                    \"args\": \"{$i}: Fizz\"\n                                }\n                            },\n                            \"alt\": {\n                                \"if\": {\n                                    \"cond\": {\n                                        \"command\": {\n                                            \"symbol\": \"==\",\n                                            \"args\": [\n                                                {\n                                                    \"command\": {\n                                                        \"symbol\": \"%\",\n                                                        \"args\": [\"$i\", 5]\n                                                    }\n                                                },\n                                                0\n                                            ]\n                                        }\n                                    },\n                                    \"conseq\": {\n                                        \"command\": {\n                                            \"symbol\": \"print\",\n                                            \"args\": \"{$i}: Buzz\"\n                                        }\n                                    },\n                                    \"alt\": {\n                                        \"command\": {\n                                            \"symbol\": \"print\",\n                                            \"args\": \"$i\"\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n]\n```\n\u003c/details\u003e\n\n## 🪧 License\nJSOP is released under MIT License. See [MIT](https://raw.githubusercontent.com/JunNishimura/JSOP/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunnishimura%2Fjsop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjunnishimura%2Fjsop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunnishimura%2Fjsop/lists"}