From a4cac3e6b1904aa84f0935942b308133a06bc58b Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Fri, 31 Jul 2020 17:47:06 +0300 Subject: [PATCH] [PHP] Add rudimentary example --- examples/polish-notation-calc/php/.gitignore | 5 +++-- examples/polish-notation-calc/php/main.php | 12 ++++++++++++ examples/polish-notation-calc/php/test.sh | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 examples/polish-notation-calc/php/main.php create mode 100755 examples/polish-notation-calc/php/test.sh diff --git a/examples/polish-notation-calc/php/.gitignore b/examples/polish-notation-calc/php/.gitignore index 8ff86ef..66f2166 100644 --- a/examples/polish-notation-calc/php/.gitignore +++ b/examples/polish-notation-calc/php/.gitignore @@ -1,2 +1,3 @@ -lexer.* -parser.* +Lexer.* +Parser.* +*.txt diff --git a/examples/polish-notation-calc/php/main.php b/examples/polish-notation-calc/php/main.php new file mode 100644 index 0000000..94d1ae6 --- /dev/null +++ b/examples/polish-notation-calc/php/main.php @@ -0,0 +1,12 @@ +getNextToken())[0] !== Lexer::TOKEN_TYPE_EOF) { + echo(Lexer::tokenToString($token[0]) . ", " . $token[1] . "\n"); + } +} diff --git a/examples/polish-notation-calc/php/test.sh b/examples/polish-notation-calc/php/test.sh new file mode 100755 index 0000000..41f1fed --- /dev/null +++ b/examples/polish-notation-calc/php/test.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +${alpaca:-alpaca} -l php $args syntax.xy &&\ + php main.php "$@" <<< "$input"