{"id":20770477,"url":"https://github.com/dannyvankooten/pepper-lang","last_synced_at":"2025-06-16T07:37:52.258Z","repository":{"id":52467699,"uuid":"240905218","full_name":"dannyvankooten/pepper-lang","owner":"dannyvankooten","description":"The Pepper Programming Language","archived":false,"fork":false,"pushed_at":"2024-02-15T15:30:17.000Z","size":1805,"stargazers_count":65,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-30T13:42:48.770Z","etag":null,"topics":["bytecode","c","compiler","interpreter","monkey-programming-language","virtual-machine"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"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/dannyvankooten.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":"2020-02-16T14:25:47.000Z","updated_at":"2025-04-15T16:18:08.000Z","dependencies_parsed_at":"2023-01-24T17:17:08.066Z","dependency_job_id":null,"html_url":"https://github.com/dannyvankooten/pepper-lang","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannyvankooten%2Fpepper-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannyvankooten%2Fpepper-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannyvankooten%2Fpepper-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannyvankooten%2Fpepper-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dannyvankooten","download_url":"https://codeload.github.com/dannyvankooten/pepper-lang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251713812,"owners_count":21631605,"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":["bytecode","c","compiler","interpreter","monkey-programming-language","virtual-machine"],"created_at":"2024-11-17T12:09:43.981Z","updated_at":"2025-04-30T13:42:55.125Z","avatar_url":"https://github.com/dannyvankooten.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pepper Programming Language\n\n\u003cimg src=\"https://raw.githubusercontent.com/dannyvankooten/pepper-lang/master/misc/logo.png\" width=\"120\" height=\"120\" align=\"right\" /\u003e\n\nPepper is an interpreted programming toy language that I wrote with a focus on simplicity and verbosity. It is dynamically typed and comes with built-in garbage collection. At the moment, it's basically a weird hybrid between C, JavaScript and Python.\n\nIt's also [quite fast](#Benchmarks) for an interpreted language that does not (yet) use JIT compilation.\n\nPepper is implemented in C11 with no external dependencies. It would have been ANSI standard if it weren't for the use of computed goto's in the VM main loop to improve CPU branch prediction.\n\n### Syntax example \n\n```js\n// Variable declarations\nlet a = 5;\nlet b = 25;\n\n// Reassign (previously declared) variables\na = a * 5;\n\n// For loops\nfor (let i = 0; i \u003c 10; i++) {\n    // i = 0 .. 9\n}\n\n// While loops\nwhile (b \u003e a) {\n    b = b - 5;\n    break;\n}\n\n// If statements\nif (b == a || a == b) {\n    print(\"b equals a!\");\n}\n\n// Strings\nlet c = \"Hello world\";\nc = str_split(c, \" \"); \ntype(c); // \"ARRAY\"\nlen(c); // 2 \n\n// Arrays\nlet d = [5, true, \"Pepper\"];\nd[0]; // 5\narray_push(d, 10);\narray_pop(d); // 10\n\n// Slices\nlet s = d[0:2]; // [5, true]\n\n// Functions\nlet fibonacci = fn(x) {\n    if (x \u003c 2) {\n        return x;\n    }\n\n    return fibonacci(x - 1) + fibonacci(x - 2);\n}\n\n// Built-in functions\nprint(\"35th fibonacci number is: \", fibonacci(35));\nprint(\"Type of c = \", type(c));\nprint(\"Length of c = \", len(c));\nprint(\"Integer value of true = \", int(true));\nfile_get_contents(\"file.txt\"); \n```\n\nMore examples can be found in the [examples](https://github.com/dannyvankooten/pepper-lang/tree/master/examples) directory.\n\n### Usage\n\nBuild Pepper interpreter (and REPL)\n```\nmake \n```\n\nLaunch the REPL\n```\nbin/pepper\n```\n\nInterpret a Pepper script: \n```\nbin/pepper examples/arithmetic.pr\n```\n\nBuild \u0026 run tests\n```\nmake check\n```\n\n### Benchmarks\n\nA benchmark to calculate the [35th fibonacci number](https://github.com/dannyvankooten/pepper-lang/blob/master/examples/fib35-recursive.pr) using a recursive function is run on every commit through [this](https://github.com/dannyvankooten/pepper-lang/actions/workflows/c.yml) Github action workflow.\n\n![Fibonacci 35 benchmark](https://raw.githubusercontent.com/dannyvankooten/pepper-lang/master/misc/benchmarks/chart.jpg)\n\nFor fun, I ran the same algorithm expressed in some other interpreted languages on the same hardware (my laptop). This is how Pepper compares:\n\n| Language   \t| fib-35    \t| string-concat-count \t| selection-sort \t|\n|------------\t|-----------\t|---------------------\t|----------------\t|\n| **Pepper** \t| **0.698** \t| **0.024**           \t| **0.349**      \t|\n| Lua 5.4    \t| 0.830     \t| 0.030               \t| 0.156          \t|\n| Node 15    \t| 0.210     \t| 0.058               \t| 0.071          \t|\n| PHP 8.0    \t| 0.480     \t| 0.036               \t| 0.595          \t|\n| PHP 5.6    \t| 2.720     \t|                     \t|                \t|\n| Pypy 7.3   \t| 0.240     \t| 0.154               \t| 0.192          \t|\n| Python 3.9 \t| 1.910     \t| 0.060               \t| 1.009          \t|\n| Ruby 3.0   \t| 0.800     \t| 0.102               \t| 0.877          \t|\n\n### License\n\nMIT licensed. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyvankooten%2Fpepper-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdannyvankooten%2Fpepper-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyvankooten%2Fpepper-lang/lists"}