{"id":22116316,"url":"https://github.com/jmid/js_of_ocaml-xyz","last_synced_at":"2025-03-24T05:41:26.991Z","repository":{"id":21073834,"uuid":"24373372","full_name":"jmid/js_of_ocaml-xyz","owner":"jmid","description":"An example of compiling a simple language processor in OCaml to JavaScript with js_of_ocaml","archived":false,"fork":false,"pushed_at":"2014-09-23T14:03:41.000Z","size":120,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T11:27:25.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmid.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":"2014-09-23T13:51:36.000Z","updated_at":"2014-09-23T13:53:09.000Z","dependencies_parsed_at":"2022-08-02T10:38:49.088Z","dependency_job_id":null,"html_url":"https://github.com/jmid/js_of_ocaml-xyz","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/jmid%2Fjs_of_ocaml-xyz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmid%2Fjs_of_ocaml-xyz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmid%2Fjs_of_ocaml-xyz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmid%2Fjs_of_ocaml-xyz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmid","download_url":"https://codeload.github.com/jmid/js_of_ocaml-xyz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245217790,"owners_count":20579297,"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-01T12:26:44.224Z","updated_at":"2025-03-24T05:41:26.971Z","avatar_url":"https://github.com/jmid.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"A js_of_ocaml example\n=====================\n\nThis is a simple example of how a language processor written in OCaml\nwith ocamllex and [menhir](http://gallium.inria.fr/~fpottier/menhir/)\ncan be compiled to a client-side JavaScript application with\n[js_of_ocaml](http://ocsigen.org/js_of_ocaml/).\n\nInternally, it builds and processes an abstract syntax tree (AST) for\na simple language of arithmetic expressions. The AST is defined in\nast.ml. It is built recursively in the action statements of each\ngrammar production in parser.mly, and it is interpreted in eval.ml.\n\nThe supported syntax is:\n\n    exp ::=  x  |  y  |  z\n         |  exp + exp\n         |  exp - exp\n         |  exp * exp\n         |  exp / exp\n         |  ( exp )\n\n\nRequirements: ocaml, ocamlfind, menhir, js_of_ocaml\n\n\nTo build:\n---------\n\n    $ make\n\n\nTo run:\n-------\n\nOpen index.html in a browser\n\n\nExample 1:\n\n    - Press 'Evaluate' (with '(x + y) * z' still in the text area)\n\n    - the result 9 appears\n\n      (hence '(x + y) * z' evaluates to 9 when x=1, y=2, and z=3)\n\n\nExample 2:\n\n    - Enter 'x + y--' (without the quotes) in the text area\n\n    - Press 'Evaluate'\n\n    - the result 'Parser.Error' appears\n\n      (hence the string 'x + y--' is rejected by the parser)\n\n\nExample 3:\n\n    - Enter '2 + 2' (without the quotes) in the text area\n\n    - Press 'Evaluate'\n\n    - the result 'Failure in lexing: empty token' appears\n\n      (hence the string '2 + 2' is rejected by the scanner)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmid%2Fjs_of_ocaml-xyz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmid%2Fjs_of_ocaml-xyz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmid%2Fjs_of_ocaml-xyz/lists"}