{"id":19581645,"url":"https://github.com/hathibelagal-dev/arpnc","last_synced_at":"2026-01-02T14:04:49.767Z","repository":{"id":227143087,"uuid":"767802617","full_name":"hathibelagal-dev/ARPNC","owner":"hathibelagal-dev","description":"Advanced RPN Calculator is trying to make your life fancier and more retro","archived":false,"fork":false,"pushed_at":"2024-03-21T02:55:24.000Z","size":67,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T08:44:56.637Z","etag":null,"topics":["forth-like","programming-language","rpn","rpn-calculator"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hathibelagal-dev.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-03-05T23:24:11.000Z","updated_at":"2024-03-20T03:51:07.000Z","dependencies_parsed_at":"2024-03-11T21:26:20.655Z","dependency_job_id":"7d1b19a2-020f-4b14-8bb1-1331a44dc0cf","html_url":"https://github.com/hathibelagal-dev/ARPNC","commit_stats":null,"previous_names":["hathibelagal-dev/arpnc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hathibelagal-dev%2FARPNC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hathibelagal-dev%2FARPNC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hathibelagal-dev%2FARPNC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hathibelagal-dev%2FARPNC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hathibelagal-dev","download_url":"https://codeload.github.com/hathibelagal-dev/ARPNC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243597798,"owners_count":20316845,"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":["forth-like","programming-language","rpn","rpn-calculator"],"created_at":"2024-11-11T07:37:30.557Z","updated_at":"2026-01-02T14:04:49.685Z","avatar_url":"https://github.com/hathibelagal-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ARPNC\n## Advanced RPN Calculator\n\nThis is, as the name suggests, an RPN calculator. We make this because we want to make the reverse polish notation popular again. We are nostalgic about those early pocket calculators and computer systems. The main reason RPN became popular during the 1970s was its ability to streamline complex mathematical calculations... while still requiring fewer keystrokes compared to the infix notation. That's exactly what we're trying to achieve in this repo. We try to do away with everything that's not absolutely necessary. No square brackets, no curly braces, no semicolons... you get the idea, we hope!\n\nWe believe that RPN is a more natural and intuitive way to do math, and write simple programs. \n\nThis is a valid program:\n\n```\n$ Hello, World! $ print\n3 2 + 5 * factorial print\n```\n\nBut anything more than a space is unnecessary. A single space is all that matters, and it matters a lot. For example, you can't skip the spaces after and before the `$` symbols when creating a string. But otherwise, this is an equally valid program:\n\n```\n$ Hello, World! $ print 3 2 + 5 * factorial print\n```\n\nThis is a stack-based calculator, so the output is:\n\n```\nHello, World!\n15511210043330985984000000\nok\n```\n\nIf you use the REPL, you don't have to say `print`. And in that mode, you also have the option to just hit **enter** after every input, just the way you did while using those old calculators. Use the word `quit` to end the session. Here's a sample session:\n\n```\nWelcome to ARPNC v0.9\n# 3\n3.0\n# 2\n2.0\n# +\n5.0\n# 2\n2.0\n# *\n10.0\n# quit\n```\n\n---\n\nYou can create functions, but all functions use the same stack. So, functions don't need to have arguments. Consider this:\n\n```\n( :sayHelloTo $ Hello $ printnn space printnn print ) $ Bob $ sayHelloTo\n```\n\nBecause space is a part of the language, if you want to print a single space, you have to use the `space` keyword. It pushes a single space character to the stack.\n\nThere's a lot more you can do with this language. This is a completely valid program too(remember, the newlines are optional):\n\n```\n2 3.2 + 5 5.1 * - 2 * dup * dup print 2 * print 5 6 * print\n13 25 - print\n$ Now trying exponentiation $ print\n2 -0.3 ** sin cos print\n$ And now tan $ print\n0.5 tan print\n$ Hello, World! How's it going?? $ print\n$ And now? $ dup print upper print\n$ Newlines are only for humans, they don't matter $ print\n2 dup log print log2 print 3 e 2 + print 2 sqrt print\n$ Constants are supported, but no variables allowed $ print\n. 3 2 1 sum @a set\n. 3 2 1 product @b set\n@b decr @c set @a @c + print\n2.1 4 19 mod 9 * mod print\n3 2 19 lsh rsh print\n5 51 * dup dup dup print16 print8 print2 print\n```\n\nIf you've used one of those HP calculators from the seventies, this syntax probably makes sense to you immediately. And if you haven't, try to think of this whole program as a bunch of push and pop operations on a stack. We're sure that you'll get it, and that you'll eventually love it. There's something awesome about this retro aesthetic.\n\nWe support operations on lists. Consider this program where we try to find the sum of a bunch of numbers:\n\n```\n. 4 5 6 10 15 sum print\n```\n\nThe output of this program is:\n\n```\n40.0\nok\n```\n\nWe support comparison operators too. Take a look at this:\n\n```\n$ Is 33 greater than 32? $ print\n32 33 \u003e print\n$ Is 33 lesser than 32? $ print\n32 33 \u003c print\n$ Is 555 equal to 555? $ print\n555 555 == print\n```\n\nThe output is, as you might have expected, this:\n\n```\nIs 33 greater than 32?\n1\nIs 33 lesser than 32?\n0\nIs 555 equal to 555?\n1\nok\n```\n\nNow, here's a test. Can you tell what's happening here:\n\n```\n5 . 2 3 5 4 2 product + 3 * print . 10 20 30 sum print\n```\n\nWe support constants, but not variables. All constants must have @ as the prefix.\n\n```\n2 3 + @a set\n5 6 * @b set\n@a @b + print\n```\n\nConditional statements generally need to make use of functions. This is because the `if` keyword merely forces the interpreter to skip the next token if there's a zero on the top of the stack. Here's an example:\n\n```\n( :sayYes $ Yes $ print ) ( :sayNo $ No $ print )\n18 @votingAge set\n19 @age set\n$ Can vote? $ print\n@votingAge @age \u003e if sayYes\n@votingAge @age \u003c if sayNo\n```\n\nRecursion is allowed. Here's some simple code that can print the multiplication table of a user-provided number:\n\n```\n( :loop dup @v * print decr dup 0 \u003c if loop )\n$ Enter number : $ print\nread @v set 10 loop drop\n```\n\nNote that you need to use the `readstr` keyword when you are expecting a string from the user. For example:\n\n```\n$ Enter name : $ print\nreadstr @name set \n$ Hello $ printnn space printnn @name print\n```\n\nIf you think this language is too wordy, you can always \"rename\" keywords to minimize keystrokes:\n\n```\n( :p print ) ( :s set ) $ Is this better? $ @a s @a p\n```\n\nTake a look at the files in the **tests** directory for more examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhathibelagal-dev%2Farpnc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhathibelagal-dev%2Farpnc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhathibelagal-dev%2Farpnc/lists"}