From 85ccdcdbf1a212995cebc5339516e4d644d91ab7 Mon Sep 17 00:00:00 2001 From: Pekka Laiho Date: Wed, 17 Jun 2020 18:10:33 +0700 Subject: [PATCH] update readme --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 51ba2e2..1d271f2 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The core project does not have any dependencies to external [Composer](https://g ## Usage -Use the **run.php** file to invoke the interpreter. You can invoke the Repl with the -r switch: +Use the **run.php** file to invoke the interpreter. You can start the Repl with the -r switch: ``` $ php run.php -r @@ -31,10 +31,17 @@ $ php run.php -e "(+ 1 2 3)" 6 ``` -Or you can evaluate a file with the -f switch: +You can evaluate a file by giving it as argument: ``` -$ php run.php -f file.mad +$ php run.php file.mad +``` + +With no arguments the script will read input from stdin: + +``` +$ echo "(+ 1 2 3)" | php run.php +6 ``` ## Types @@ -271,6 +278,15 @@ one? | Return true if the argument is integer 1 (strict comparison). even? | Return true if the argument is even number (0, 2, 4, ...). odd? | Return true if the argument is odd number (1, 3, 5, ...). +## Constants + +The following constants are defined by default: + +Name | PHP constant +------- | ------------ +pi | M_PI +ln | PHP_EOL + ## Extending The project is easy to extend because it is trivial to add new functions whether the implementation is defined on the PHP or Lisp side. If the language ends up being used in the future, first plans are to add support for JSON serialization and a HTTP client.