{"id":22316901,"url":"https://github.com/somecho/cli-calculator","last_synced_at":"2025-03-26T03:25:56.282Z","repository":{"id":218550680,"uuid":"746717446","full_name":"somecho/cli-calculator","owner":"somecho","description":"simple cli calculator created in rust","archived":false,"fork":false,"pushed_at":"2024-01-22T17:38:53.000Z","size":19,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T02:03:14.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/somecho.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}},"created_at":"2024-01-22T14:36:36.000Z","updated_at":"2024-01-22T14:59:14.000Z","dependencies_parsed_at":"2024-01-22T19:02:37.546Z","dependency_job_id":"a2fb2184-3ff0-4eba-91a5-f2609a9ac340","html_url":"https://github.com/somecho/cli-calculator","commit_stats":null,"previous_names":["somecho/cli-calculator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Fcli-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Fcli-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Fcli-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somecho%2Fcli-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/somecho","download_url":"https://codeload.github.com/somecho/cli-calculator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245581795,"owners_count":20639045,"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":[],"created_at":"2024-12-03T23:08:13.663Z","updated_at":"2025-03-26T03:25:56.262Z","avatar_url":"https://github.com/somecho.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cli Calculator\n\nThis is a simple cli calculator created in Rust. It's a personal project to learn about interpreters. The calculator is a scientific calculator with a limited feature set:\n- arithmetic operations: `-`, `+`, `*`, `/` and `%`  \n- trigonometric functions: `cos`, `sin` and `tan`\n- other functions: `max`, `min`, `floor`, `ceil`, `log`\n\nAdditionally, this calculator allows the definitions of variables with the `let` keyword.\n\n## Usage\nAfter running the following commands, you will enter a REPL where you can type in mathematical expressions to be calculated.\n```\ngit clone https://github.com/somecho/cli-calculator\ncd cli-calculator\ncargo run\n```\n\n### Syntax\nThis calculator uses conventional mathematical notation (i.e. infix). For functions, the syntax reads a little bit more like programming languages. The syntax for functions is `FUNCTION(ARG)` for functions with single arity, `FUNCTION(ARG,ARG)` for functions with double aritoes and `FUNCTION(ARG,ARG,...)` for functions with multiple arities. \n\n#### Examples\n- Single arity: `cos(3.1415)`\n- Double arity: `pow(2,5.14)`\n- Multiple arity:  `min(1,2,3,4,7)`\n\nExpressions can be nested. `min(cos(max(5,10)),pow(10,2),log(100))` would be a valid expression. \n\n### Variables\nVariables can be defined using the `let` keyword.\n```\nlet a = 10\na * 10\n=\u003e returns 100\n```\n## Architecture\nThe program follows a simple architecture, first [scanning](./src/scanner.rs) the input string to produce a list of tokens. The tokens then get parsed using recursive descent into an [abstract syntax tree](./src/ast.rs), which then finally can be [evaluated](./src/evaluate.rs).\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsomecho%2Fcli-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsomecho%2Fcli-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsomecho%2Fcli-calculator/lists"}