{"id":13647682,"url":"https://github.com/ARM-software/asl-interpreter","last_synced_at":"2025-04-22T02:32:31.569Z","repository":{"id":66788251,"uuid":"203827048","full_name":"ARM-software/asl-interpreter","owner":"ARM-software","description":"Example implementation of Arm's Architecture Specification Language (ASL)","archived":false,"fork":false,"pushed_at":"2019-08-30T14:00:52.000Z","size":84,"stargazers_count":102,"open_issues_count":1,"forks_count":26,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-03T01:37:49.428Z","etag":null,"topics":["architecture","arm","formal-specification","interpreter","specification"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ARM-software.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-08-22T15:52:20.000Z","updated_at":"2024-07-24T09:39:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4499383-4e91-4748-9ef5-2b56296193bf","html_url":"https://github.com/ARM-software/asl-interpreter","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/ARM-software%2Fasl-interpreter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARM-software%2Fasl-interpreter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARM-software%2Fasl-interpreter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARM-software%2Fasl-interpreter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ARM-software","download_url":"https://codeload.github.com/ARM-software/asl-interpreter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223887804,"owners_count":17219994,"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":["architecture","arm","formal-specification","interpreter","specification"],"created_at":"2024-08-02T01:03:42.422Z","updated_at":"2024-11-09T21:31:16.453Z","avatar_url":"https://github.com/ARM-software.png","language":"OCaml","readme":"# ASL Interpreter\n\n## Introduction\n\nExample implementation of Arm's Architecture Specification Language (ASL).\n\nThe ASL interpreter is a collection of resources to help you to\nunderstand and make use of Arm's architecture specifications.\nIt consists of lexer, parser, typechecker and interpreter for the ASL language\nand an interactive interface for evaluating ASL statements and expressions.\n\n## Requirements\n\nTo build and run the ASL interpreter, you will need:\n\n  * OCaml version 4.07 (other versions may work)\n  * OPAM OCaml version 2.0.5 (other versions may work)\n  * The following OPAM packages\n      * ocaml     - OCaml compiler\n      * menhir    - parser generator tool\n      * ocamlfind - build tool for OCaml\n      * ott.0.29  - tool for defining language grammars and semantics (this version or later required)\n      * linenoise - OCaml line editing library\n      * pprint    - OCaml pretty-printing library\n      * z3.4.7.1  - OCaml bindings for the Z3 SMT solver (exactly this version is required)\n      * zarith    - OCaml multiprecision arithmetic library\n\n## License and contribution\n\nThe software is provided under the [BSD-3-Clause licence](https://spdx.org/licenses/BSD-3-Clause.html).\nContributions to this project are accepted under the same licence.\n\nThis software includes code from one other open source projects\n\n * The [CIL project](https://people.eecs.berkeley.edu/~necula/cil/)\n   defines a useful\n   [visitor class](https://github.com/cil-project/cil/blob/936b04103eb573f320c6badf280e8bb17f6e7b26/src/cil.ml#L931)\n   for traversing C ASTs.\n   The file `visitor.ml` is a modified copy of this class that generalizes\n   the type to work with an arbitrary AST.\n\n   CIL is distributed under a [BSD-3-Clause licence](https://github.com/cil-project/cil/blob/develop/LICENSE).\n\n\n## Building and development\n\n### Directory structure\n\nThis interpreter consists of a single directory organized as follows\n\n  * Metadata, documentation, etc:\n      * `LICENCE`             - Software licence\n      * `README.md`           - This file\n      * `asli.odocl`          - Manifest (for documentation generation)\n      * `Makefile`            - build system file\n      * `_tags`               - OCaml build system configuration file\n  * Source code consisting of\n      * Lexer\n          * `lexer.mll`       - ASL lexer (ocamllex file)\n          * `lexersupport.ml` - indentation-based parsing support\n      * Grammar and Parser\n          * `asl.ott`         - used to generate the ASL parser and abstract syntax tree (OTT file)\n          * `asl_visitor.ml`  - code to traverse abstract syntax tree\n          * `asl_utils.ml`    - code to transform abstract syntax tree\n      * Typechecker\n          * `tcheck.ml`       - typechecker\n      * Interpreter\n          * `primops.ml`      - implementation of ASL builtin types and operations\n          * `value.ml`        - interpreter support code\n          * `eval.ml`         - evaluator for ASL language\n      * ASL standard library\n          * `prelude.asl`     - builtin types and functions\n      * Programs\n          * `asli.ml`         - interactive ASL tool\n          * `testlexer.ml`    - test program that converts ASL code to list of tokens\n      * Misc\n          * `utils.ml`        - utility code\n  * Code copied from other open source projects\n      * `visitor.ml`\n\n\n### Installing dependencies\n\nPlatform specific instructions:\n```\n    MacOS: brew install opam\n    Ubuntu: sudo apt-get install opam\n```\nPlatform independent instructions:\n\n```\n    opam install ocaml\n    opam install menhir\n    opam install ocamlfind\n    opam install ott\n    opam install linenoise\n    opam install pprint\n    opam install z3.4.7.1\n    opam install zarith\n\n    eval `opam config env`\n```\n\nYou also need to execute this command\n\n```\n    MacOS: export DYLD_LIBRARY_PATH=`opam config var z3:lib`\n    Linux: export LD_LIBRARY_PATH=`opam config var z3:lib`\n```\n\n\n### Building\n\nTo build the ASL lexer, the ASL interpreter and PDF files containing the ASL\ngrammar, execute these commands.\n\n```\n    make testlexer.native asli pdf doc\n```\n\n### Using ASL lexer\n\nThis displays a list of tokens in an ASL file including the indent\nand dedent tokens used to support indentation-based parsing.\n\n```\n    $ ./testlexer.native prelude.asl\n```\n\n### Using ASL interpreter\n\nThis reads ASL files specified on the command line and\nprovides an interactive environment for executing ASL\nstatements and expressions.\n\n```\n    $ ./asli\n                _____  _       _    ___________________________________\n        /\\     / ____|| |     (_)   ASL interpreter\n       /  \\   | (___  | |      _    Copyright Arm Limited (c) 2017-2019\n      / /\\ \\   \\___ \\ | |     | |\n     / ____ \\  ____) || |____ | |   Version 0.0 alpha\n    /_/    \\_\\|_____/ |______||_|   ___________________________________\n\n    Type :? for help\n    ASLi\u003e 1+1\n    2\n    ASLi\u003e ZeroExtend('11', 32)\n    '00000000000000000000000000000011'\n    ASLi\u003e bits(32) x = ZeroExtend('11', 32);\n    ASLi\u003e x\n    '00000000000000000000000000000011'\n    ASLi\u003e :quit\n```\n\nEnjoy!\n","funding_links":[],"categories":["OCaml"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FARM-software%2Fasl-interpreter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FARM-software%2Fasl-interpreter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FARM-software%2Fasl-interpreter/lists"}