{"id":22292388,"url":"https://github.com/abodelot/aspic-cpp","last_synced_at":"2025-03-25T21:46:36.885Z","repository":{"id":3540351,"uuid":"4600341","full_name":"abodelot/aspic-cpp","owner":"abodelot","description":"Expression interpreter in C++","archived":false,"fork":false,"pushed_at":"2020-02-26T23:45:38.000Z","size":215,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T21:02:15.431Z","etag":null,"topics":["c-plus-plus","pratt-parser","toy-language"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abodelot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-08T17:46:54.000Z","updated_at":"2021-06-27T21:34:37.000Z","dependencies_parsed_at":"2022-08-06T14:01:14.083Z","dependency_job_id":null,"html_url":"https://github.com/abodelot/aspic-cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abodelot%2Faspic-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abodelot%2Faspic-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abodelot%2Faspic-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abodelot%2Faspic-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abodelot","download_url":"https://codeload.github.com/abodelot/aspic-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245550540,"owners_count":20633872,"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":["c-plus-plus","pratt-parser","toy-language"],"created_at":"2024-12-03T17:21:41.379Z","updated_at":"2025-03-25T21:46:36.865Z","avatar_url":"https://github.com/abodelot.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Aspic\n=====\n\nAspic is an expression interpreter written in C++.\nThe parser implementation is based upon the [Pratt parsing technique](https://en.wikipedia.org/wiki/Pratt_parser).\n\n* Author: Alexandre Bodelot \u003calexandre.bodelot@gmail.com\u003e\n* Website: https://github.com/abodelot/aspic\n\n## Build\n\n1. Install GNU readline library. On Debian/Ubuntu:\n\n    ```\n    sudo apt install libreadline-dev\n    ```\n\n2. Build with make:\n\n    ```\n    make\n    ```\n\n## Usage\n\n- Interactive mode: `./aspic`\n- Load a file: `./aspic \u003cpath_to_file\u003e`\n\n## Testing\n\nAspic is tested with its own `assert` function. Tests can be run with:\n\n```\n./tests/run.sh\n```\n\n## Aspic Syntax\n\nAspic syntax is close to Ruby and Python.\n\nAll syntactic constructs may be separated by an arbitrary number of whitespace characters and comments.\n\nThe whitespace characters are space and tab. Newlines work as whitespace only when expressions obviously continues to the next line:\n\n    a = 10 +\n        20\n\n    b = len(\n        \"hello world!\"\n    )\n\n    c = [\n        10,\n        20,\n        30\n    ]\n\nAspic treats newlines as a significant end-of-expression only if the following conditions are met:\n\n- Last token of the line is a literal value, an identifier, or a closing pair character (`)`, `]`, or `}`).\n- Newline is not inside a pair of brackets (`()`, `[]`, or `{}`).\n\n### Identifiers\n\nExamples:\n\n    foobar\n    _foobaz\n    foo_bar2\n\nAspic identifiers consist of letters (`A-Z`, `a-z`), decimal digits (`0-9`), and the underscore character (`_`), and begin with a letter or and underscore. There are no restrictions on the lengths of identifiers.\n\n### Comments\n\nExamples:\n\n    # this is a comment line\n    a += 1 # increment a\n\nAspic comments start with `#` character outside of a string and all following text until the end of the line.\n\n### Reserved words\n\nThe reserved words are:\n\n    elif else end false if null true while\n\nThey cannot be used as identifiers.\n\n### Types\n\n* int\n* float\n* string\n* boolean (literals `true` and `false`)\n* null (literal `null`)\n* built-in function\n* array\n* hashmap\n\n### Operators\n\nAspic defines the following operators:\n\n| Syntax | Name | Right associative? |\n|--------|------|--------------------|\n| `[]`   | Subscript | |\n| `()`   | Function call | |\n| `!`    | Unary not | ✓ |\n| `+`    | Unary plus | ✓ |\n| `-`    | Unary minus | ✓ |\n| `**`   | Pow | ✓ |\n| `*`    | Multiplication | |\n| `%`    | Modulo | |\n| `/`    | Division | |\n| `+`    | Addition | |\n| `-`    | Subtraction | |\n| `\u003c`    | Less than | |\n| `\u003c=`   | Less than or equal | |\n| `\u003e`    | Greater than | |\n| `\u003e=`   | Greater than or equal | |\n| `==`   | Equal | |\n| `!=`   | Not equal | |\n| `\u0026\u0026`   | Logical and | |\n| `\\|\\|` | Logical or | |\n| `=`    | Assignment | ✓ |\n| `*=`   | Multiply and assign | ✓ |\n| `/=`   | Divide and assign | ✓ |\n| `%=`   | Modulo and assign | ✓ |\n| `+=`   | Add and assign | ✓ |\n| `-=`   | Subtract and assign | ✓ |\n\n### Expressions\n\nAspic programs are sequence of expressions. Each expression are delimited by newlines.\n\n#### Array expression\n\nSyntax:\n\n\t`[' expr, ...`]'\n\nExamples:\n\n    []\n\t[1, 2, 3]\n    [\"abc\", [3.14, 4.93]]\n\nReturns a new array, which contains result of each expressions.\n\n#### HashMap expression\n\nSyntax:\n\n    { expr: expr, ... }\n\nExamples:\n\n    {}\n    {\"a\": 1, \"b\": 2}\n    {123: [\"hello\", \"world\"]}\n\nReturns a new hashmap object, which maps each key to corresponding value.\n\n### Control structures\n\nControl structures in Aspic are expressions too, and have some value.\n\n#### if\n\n`if` expressions are used for conditional execution.\n\nSyntax:\n\n    if expr\n        expr...\n    [elif expr\n        expr...]...\n    [else\n        expr...]\n    end\n\nExamples:\n\n    if x \u003e 0\n        print(\"strictly positive\")\n    end\n\n    if foobar == foobaz\n        do_a()\n    elif foobar == barbaz\n        do_b()\n    else\n        do_c()\n    end\n\n    x = if test\n        do_a()\n    else\n        do_b()\n    end\n\n#### while\n\nExecutes body while condition expression returns true.\n\nSyntax:\n\n    while expr\n        expr...\n    end\n\nExample:\n\n    i = 0\n    while i \u003c 10\n        print(i)\n        i += 1\n    end\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabodelot%2Faspic-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabodelot%2Faspic-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabodelot%2Faspic-cpp/lists"}