From 427c6c19b80017aad668bd0d47abf7f9017b7895 Mon Sep 17 00:00:00 2001 From: Daniel Berezin Date: Tue, 18 Jun 2019 20:00:19 -0700 Subject: [PATCH] Updated info for npm --- README.md | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 923359b..15adc56 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This is yet another Javascript Implementation. ## Installation ```bash -$ npm install yali.js +$ npm install yalijs ``` ## CLI Usage @@ -49,11 +49,12 @@ run(source_code, environment = new Environment(), printfn = console.log, debug = You can pass in an `environment` object, which lets you define built-in variables and functions like so: ```javascript -const { run, Environment } = require('yali') +const { run, Environment } = require('yalijs') const env = new Environment() env.setBuiltin('owner', 'dberezin') env.setBuiltin('meaning_of_life', 42) env.setBuiltin('alert', (interpreter, arg) => alert(arg[0])) +run('print meaning_of_life;', env) ``` You can also pass in a `printfn` that will be called for every `print` statement. Here's an example for capitalizing each word in the stdout: diff --git a/package.json b/package.json index 5dcf2ca..861072e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "yali", + "name": "yalijs", "version": "1.0.0", "description": "Yet Another Lox Interpreter. Javascript Implementation of the Lox Programming Language", "main": "index.js",