{"_id":"@alu0100792218/eloquentjsegg","_rev":"5-ae81a1cf9bc2ad998404778c6477f2ae","name":"@alu0100792218/eloquentjsegg","dist-tags":{"latest":"2.2.0"},"versions":{"2.0.0":{"name":"@alu0100792218/eloquentjsegg","version":"2.0.0","description":"* [Eloquent JS. Chapter 11. Project: A Programming Language](http://eloquentjavascript.net/11_language.html) * [Deploy at GitHub](https://ULL-ESIT-PL-1617.github.io/egg)","main":"lib/eggvm.js","scripts":{"test":"mocha","start":"./bin/egg.js examples/two.egg","compile":"./bin/eggc.js examples/two.egg && ./bin/evm.js examples/two.egg.evm"},"bin":{"egg":"./bin/egg.js","eggc":"./bin/eggc.js","evm":"./bin/evm.js"},"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-1617/egg.git"},"keywords":["parsing","lisp","Language"],"author":{"name":"alu0100792218"},"license":"ISC","bugs":{"url":"https://github.com/ULL-ESIT-PL-1617/egg/issues"},"homepage":"https://github.com/ULL-ESIT-PL-1617/egg#readme","devDependencies":{"gulp-shell":"^0.6.5","mocha":"^5.0.4","should":"^13.2.1","xregexp":"latest","test-console":"latest","sinon":"latest"},"gitHead":"17d91b481b13eef29a302bf4cc281c6edee09f0e","_id":"@alu0100792218/eloquentjsegg@2.0.0","_shasum":"7a5da2ca5dc02bb8d32b03ab2a27252a449b591e","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"alu0100792218","email":"alu0100792218@ull.edu.es"},"dist":{"shasum":"7a5da2ca5dc02bb8d32b03ab2a27252a449b591e","tarball":"https://registry.npmjs.org/@alu0100792218/eloquentjsegg/-/eloquentjsegg-2.0.0.tgz","fileCount":48,"unpackedSize":54885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa6YNCCRA9TVsSAnZWagAACp4P/RWgKtxhsg886403aFAq\nrGaaJ1elgqYBEoboo3RdYFsQqD1wGWbLIh5ILT5VaTYcQaAOWUh5mGH4bP8h\nCTPk9ujC2GIyTzgs3ABl8Oz4cI5LR5u5uLw/FMAyR7Rms+Argj7WQBfemaJm\nhcAykN2Mv4UFNw6eimUJFshImyDPbgN+wcIqWUu2qwlCg8aDh2ExatkyxhxC\nfiM7cwYRQz+ILqNKZf00Bi4HcG2N0nZzUpOx0bbOhILbrQDai30IFYiqOR/J\nGz0cC9is0lkvqcggzC2lcoV8pvncszWQZu+lvRHlfIMNW5m0XWd8HYMOwVM1\ngOvnT3E1HcaTkNhhhMPjRY2R/AkoqlF0H2Oe0WHrZ0RUwRXuEvKgobQGebBB\nD1CjgSaLWeLRQz8rhc45NkEDZHtz4MmObW0N30rDADmCoM2aOADKswlIcIZV\nFmAOFnaYG1LJeQlpX0v5j/oYSEL6teSG0QhfDM8hYgWZifE23FRHv7axlC34\nGVrscfEYJ2+ROKKzVxumRr1T6xEwjZnbA5uiBGDAeACeb0VBnjpmOdK7LQSa\nhuQfk6nZCMB4RtzfAE3iT9ZcFt1yfnTwPWfhWFdeTaQfFyAdMwBraXOx22j8\ngRP2R939y7bOop54iY3SzxhkLQPZgX8LW+ayVM0ni5QG3SCpfrLOozRcTc6C\nDrN2\r\n=4pDF\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-IASXBc8ZY/cgfS/fhTijcfc2gsVzsHG2nAcG182ei3+3qn7ofPxkcmAbFDJyfoBnoSmlGF7ikD2Y5ZFDarbjMQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTBlu68eoq8VKoHF52JKos7DzcLUn7KxDYzMjS1OuGJgIhANj0Hs/78imZjSNCZgkTKyY537LW7JcpA30T2s5Uf+Qx"}]},"maintainers":[{"name":"alu0100792218","email":"alu0100792218@ull.edu.es"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eloquentjsegg_2.0.0_1525252929534_0.23218447976552015"},"_hasShrinkwrap":false},"2.1.0":{"name":"@alu0100792218/eloquentjsegg","version":"2.1.0","description":"* [Eloquent JS. Chapter 11. Project: A Programming Language](http://eloquentjavascript.net/11_language.html) * [Deploy at GitHub](https://ULL-ESIT-PL-1617.github.io/egg)","main":"lib/eggvm.js","scripts":{"test":"mocha","start":"./bin/egg.js examples/two.egg","compile":"./bin/eggc.js examples/two.egg && ./bin/evm.js examples/two.egg.evm"},"bin":{"egg":"./bin/egg.js","eggc":"./bin/eggc.js","evm":"./bin/evm.js"},"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-1617/egg.git"},"keywords":["parsing","lisp","Language"],"author":{"name":"alu0100792218"},"license":"ISC","bugs":{"url":"https://github.com/ULL-ESIT-PL-1617/egg/issues"},"homepage":"https://github.com/ULL-ESIT-PL-1617/egg#readme","devDependencies":{"gulp-shell":"^0.6.5","mocha":"^5.0.4","should":"^13.2.1","xregexp":"latest","test-console":"latest","sinon":"latest"},"gitHead":"b35e4efccc0edaaf320f8dcf2f1b15bf635c838f","_id":"@alu0100792218/eloquentjsegg@2.1.0","_npmVersion":"5.6.0","_nodeVersion":"9.9.0","_npmUser":{"name":"alu0100792218","email":"alu0100792218@ull.edu.es"},"dist":{"integrity":"sha512-kwIZnSYXd82dKE9ZiwhaOPHHgao7+8ACpFDyen5ZY8+t/0WOgj/9uQ2xN/YjfjorEHTMXVKlovYeyqEdLmR9dg==","shasum":"537383fa5b1b2ea3fc90295853ce22c6758695d2","tarball":"https://registry.npmjs.org/@alu0100792218/eloquentjsegg/-/eloquentjsegg-2.1.0.tgz","fileCount":47,"unpackedSize":55438,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa9B3bCRA9TVsSAnZWagAA72IP/29iH0twqVLxMNmNN+cB\nZDEpKsfeDxld9NBy/QV30/bAvwkkQAEBonCQPUyspbFDmDIC8+ulVzEVEgk3\nJMzZyevaV+fA8t8rpovLcqi59I309RvPu0bRpSxUJNUmnuUQgQ2ikahIZu9/\nBVjb0SPfyVhh6Yqe2C45ToYqxjyQ654R0R/HFYT8f7TIwTL0hYM5MhA9+sBa\nHV+JoSQdWjaA9trA451+7vxaKZgkO8ewIEiufVuuJj9XENMFMn81EfLfXkgm\nRRJfhPAba3J5PJ7bo78Ufc85N80ELbcqggJIBtBM9qulckoLINRUOw8OUllJ\njIfk6d7ssGa/6uNKvzRTBIAzetfsV9Yi72d3ulb2NpVN3H2rNVja4kRlrI2d\nmaoUwGj5V6glbJWWV4fKkVpk3RCMwaaupKJxv01RNxMxOYJrD0ZbKbhXAvjM\njpnplVLENk688ggoJJAlhp3kbD7VQWFnx2xbsto/lmLpVMYn302CIfT+cHdr\nZHuSgJy2mD/wYfhlhqo0h/tdi8Hf539zvztDJOTrQThfgppq67cvSN5SJVDP\nLkCX4xgOpCE2rtDv5i/EPAI/K/pkq7D5Op9541ifORxBRaMMjIUGgPASk58Y\nvEP6R8H17FjOjBLFZsezgUhxm07KugItCRGYarGqDYXoA/rWTCpIhOhYGO8a\neEjS\r\n=ftNY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCUs3h6F995uVfUYweCwK5gL1X1qqcjSS9yZvlGBaEyLwIhAKtu2uH/2UBBPeRIAZn5LMJUnOBU1ENReydkQWy1N0Dn"}]},"maintainers":[{"name":"alu0100792218","email":"alu0100792218@ull.edu.es"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eloquentjsegg_2.1.0_1525947864863_0.9141595099806035"},"_hasShrinkwrap":false},"2.2.0":{"name":"@alu0100792218/eloquentjsegg","version":"2.2.0","description":"* [Eloquent JS. Chapter 11. Project: A Programming Language](http://eloquentjavascript.net/11_language.html) * [Deploy at GitHub](https://ULL-ESIT-PL-1617.github.io/egg)","main":"lib/eggvm.js","scripts":{"test":"mocha","start":"./bin/egg.js examples/two.egg","compile":"./bin/eggc.js examples/two.egg && ./bin/evm.js examples/two.egg.evm"},"bin":{"egg":"./bin/egg.js","eggc":"./bin/eggc.js","evm":"./bin/evm.js"},"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-1617/egg.git"},"keywords":["parsing","lisp","Language"],"author":{"name":"alu0100792218"},"license":"ISC","bugs":{"url":"https://github.com/ULL-ESIT-PL-1617/egg/issues"},"homepage":"https://github.com/ULL-ESIT-PL-1617/egg#readme","devDependencies":{"gulp-shell":"^0.6.5","mocha":"^5.0.4","should":"^13.2.1","xregexp":"latest","test-console":"latest","sinon":"latest"},"gitHead":"021b6bcc509b4e647c6e73a0b912b8c9f6733e19","_id":"@alu0100792218/eloquentjsegg@2.2.0","_npmVersion":"6.1.0","_nodeVersion":"8.10.0","_npmUser":{"name":"alu0100792218","email":"alu0100792218@ull.edu.es"},"dist":{"integrity":"sha512-HFMRr7/9iDLNaHCLjjG+1TfdNzyvSbjha/sbUICuBta/j7QgyZkahkP19LgwvMRiXpkcBkFgFJYx94NXUlp5qA==","shasum":"0b5e7dd2a0c8ed65e56e0abfc923be1a7b4d8ce0","tarball":"https://registry.npmjs.org/@alu0100792218/eloquentjsegg/-/eloquentjsegg-2.2.0.tgz","fileCount":46,"unpackedSize":55391,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbHGqVCRA9TVsSAnZWagAANeMP/RZDE0QBcpY+BTfymt2n\niTA/ztgMIfYhErsKtqX5cpsjWZo/AyizmlgFkWIhqY1gpjaTlYGNRyNRelXh\nH4PbcSdj9PlF7XIjz8hTJEs263fwo8cjgRrgje+Q+xOFPFJy9vclpMC81ZvT\nc076/4Nl+C1e1gXAYd6MQ4EfXdG3qoSxh1bJ95aGhYBHwh+w4vDnzrbt/u2i\nXFqn3LwglLFgwYk53BrMCwgKXrH7/6HE5XdXkLIE7kUgo/fmQHsu7xmn5NYN\nAUwW4/l3mJsxN3CCeUdouLvtNpzQzlpyDhMUae7THFVyQBjmWq7ckzAPy/gv\nO3x9TiIIbjiW7ujWtNXt3XDsBoubusdOdv/U2J0ty26iEdRZUZBlTyQOq1ce\nJKNRP/5PGm1SAXOWW3tRJpDMtO1Q1OSPe4W61lonoRo1RYslbdRqrccplhyf\n1Mq5F/Hdb+gbXdlKCfM4m3Wmh8jSqrtYNpvtFIzHb+100plPwq6r3RtpKLwQ\nG73A02sfho08zyggbc8KNGWJZNCSHLpsnXOB1wma87r03jFMSdzegzHStcvW\naOcFzrD9ayrS9M6fWtUBhbZFHHHtgMhVfgcZLBGKgkhMtk4CgJtC8DEYZoNx\nRTa4874C2iSwSfT/L1El2YawQUdmyc0/P5YaLoYhoHa+5r7buQeQEB7v450E\nyflB\r\n=rwff\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEjDW3AkRwiTBDow7ZomBP61cOl4b14Eo3nh6SvpRt9gIhANub8b+2NL/ZfLBgWKsDM7nWRE955xcKdjz3291TmjL9"}]},"maintainers":[{"name":"alu0100792218","email":"alu0100792218@ull.edu.es"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eloquentjsegg_2.2.0_1528588947934_0.4101841255680154"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-02T09:22:09.474Z","2.0.0":"2018-05-02T09:22:09.641Z","modified":"2022-06-12T14:36:01.590Z","2.1.0":"2018-05-10T10:24:25.067Z","2.2.0":"2018-06-10T00:02:28.043Z"},"maintainers":[{"name":"alu0100792218","email":"alu0100792218@ull.edu.es"}],"description":"* [Eloquent JS. Chapter 11. Project: A Programming Language](http://eloquentjavascript.net/11_language.html) * [Deploy at GitHub](https://ULL-ESIT-PL-1617.github.io/egg)","homepage":"https://github.com/ULL-ESIT-PL-1617/egg#readme","keywords":["parsing","lisp","Language"],"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-1617/egg.git"},"author":{"name":"alu0100792218"},"bugs":{"url":"https://github.com/ULL-ESIT-PL-1617/egg/issues"},"license":"ISC","readme":"[![Build Status](https://travis-ci.org/ULL-ESIT-PL-1617/egg.svg?branch=master)](https://travis-ci.org/ULL-ESIT-PL-1617/egg)\n[![npm version](https://badge.fury.io/js/%40crguezl%2Feloquentjsegg.svg)](https://badge.fury.io/js/%40crguezl%2Feloquentjsegg)\n\n### Code from Eloquent JS. Chapter 11. Project: A Programming Language\n\n* [Eloquent JS. Chapter 11. Project: A Programming Language](http://eloquentjavascript.net/11_language.html)\n* [As an npm module](https://www.npmjs.com/package/@crguezl/eloquentjsegg)\n* [gist to check the npm module](https://gist.github.com/crguezl/8dfcaa01a0377dead374bc35c462c29d)\n\n### Grammar\n\n```Yacc\n\nexpression: STRING\n          | NUMBER\n          | WORD apply \n\napply: /* vacio */\n     | '(' (expression ',')* expression? ')' apply\n\n\nWHITES = /^(\\s|[#;].*|\\/\\*(.|\\n)*?\\*\\/)*/;\nSTRING = /^\"((?:[^\"\\\\]|\\\\.)*)\"/;\nNUMBER = /^([-+]?\\d*\\.?\\d+([eE][-+]?\\d+)?)/;\nWORD   = /^([^\\s(),\"]+)/;\n```\n\n### AST\n\n* Expressions of type \"VALUE\" represent literal strings or numbers. \nTheir `value` property contains the string or number value that they represent.\n\n* Expressions of type \"WORD\" are used for identifiers (names). Such objects have a `name` property that holds the identifier’s name as a string. \n* Finally, \"APPLY\" expressions represent applications. They have an `operator` property that refers to the expression that is being applied, and an `args` property that holds an array of argument expressions.\n\n```\nast: VALUE{value: String | Number}\n   | WORD{name: String}\n   | APPLY{operator: ast, args: [ ast ...]}\n```\n\nThe `>(x, 5)` would be represented like this:\n\n```bash\n$ cat greater-x-5.egg \n>(x,5)\n$ ./eggc.js greater-x-5.egg \n$ cat greater-x-5.egg.evm \n{\n  \"type\": \"apply\",\n  \"operator\": {\n    \"type\": \"word\",\n    \"name\": \">\"\n  },\n  \"args\": [\n    {\n      \"type\": \"word\",\n      \"name\": \"x\"\n    },\n    {\n      \"type\": \"value\",\n      \"value\": 5\n    }\n  ]\n}\n```\n\n### Examples\n\n* [Directory with examples](https://github.com/ULL-ESIT-PL-1617/egg/tree/master/examples)\n\n### Instalation\n\n```\n$ npm i -g @crguezl/eloquentjsegg\n...\n```\n\n### Executables\n\n* `egg` \n    - Runs an egg program: `egg examples/two.egg` compiles the source onto the AST and interprets the AST\n\n```\n$ cat one.egg\ndo(\n  define(x, 4),\n  define(setx, fun(val, \n      set(x, val)\n    )\n  ),\n  setx(50),\n  print(x)\n)\n$ egg one.egg\n50\n```\n\n* `eggc`\n    - Compiles the input program to produce a JSON containing the tree: `eggc examples/two.egg` produces the JSON file `examples/two.egg.evm`\n* `evm` \n    - Egg Virtual Machine. Runs the tree: `evm examples/two.egg.evm`\n```\n$ eggc one.egg\n$ ls -ltr | tail -1\n-rw-r--r--  1 casiano  wheel  1656 19 mar 08:05 one.egg.evm\n$ evm one.egg.evm \n50\n```\n\nHere is the tree in JSON format for the former `one.egg` program:\n\n```\n$ cat one.egg.evm\n{\n  \"type\": \"apply\",\n  \"operator\": {\n    \"type\": \"word\",\n    \"name\": \"do\"\n  },\n  \"args\": [\n    {\n      \"type\": \"apply\",\n      \"operator\": {\n        \"type\": \"word\",\n        \"name\": \"define\"\n      },\n      \"args\": [\n        {\n          \"type\": \"word\",\n          \"name\": \"x\"\n        },\n        {\n          \"type\": \"value\",\n          \"value\": 4\n        }\n      ]\n    },\n    {\n      \"type\": \"apply\",\n      \"operator\": {\n        \"type\": \"word\",\n        \"name\": \"define\"\n      },\n      \"args\": [\n        {\n          \"type\": \"word\",\n          \"name\": \"setx\"\n        },\n        {\n          \"type\": \"apply\",\n          \"operator\": {\n            \"type\": \"word\",\n            \"name\": \"fun\"\n          },\n          \"args\": [\n            {\n              \"type\": \"word\",\n              \"name\": \"val\"\n            },\n            {\n              \"type\": \"apply\",\n              \"operator\": {\n                \"type\": \"word\",\n                \"name\": \"set\"\n              },\n              \"args\": [\n                {\n                  \"type\": \"word\",\n                  \"name\": \"x\"\n                },\n                {\n                  \"type\": \"word\",\n                  \"name\": \"val\"\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"type\": \"apply\",\n      \"operator\": {\n        \"type\": \"word\",\n        \"name\": \"setx\"\n      },\n      \"args\": [\n        {\n          \"type\": \"value\",\n          \"value\": 50\n        }\n      ]\n    },\n    {\n      \"type\": \"apply\",\n      \"operator\": {\n        \"type\": \"word\",\n        \"name\": \"print\"\n      },\n      \"args\": [\n        {\n          \"type\": \"word\",\n          \"name\": \"x\"\n        }\n      ]\n    }\n  ]\n}\n```\n### Using it as a library\n\n```js\n> egg = require('@crguezl/eloquentjsegg')\n{ run: [Function: run],\n  runFromFile: [Function: runFromFile],\n  runFromEVM: [Function: runFromEVM],\n  parser: \n   { getProgram: [Function: getProgram],\n     lex: [Function: lex],\n     parse: [Function: parse],\n     parseApply: [Function: parseApply],\n     parseExpression: [Function: parseExpression],\n     parseFromFile: [Function: parseFromFile],\n     setProgram: [Function: setProgram] } }\n> parser = egg.parser\n> parser.parse('def(x,4)')\n{ type: 'apply',\n  operator: { type: 'word', name: 'def' },\n  args: [ { type: 'word', name: 'x' }, { type: 'value', value: 4 } ] }\n```\n","readmeFilename":"README.md"}