From 23c94b1d0671b3233edafa5ef49a55b67de4ca29 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 28 Oct 2020 17:30:09 +0100 Subject: [PATCH] doc: add README --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a2e9d31 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Evalexpr + +This was a small experiment in writing a precedence climbing parser, using C. +I also have my reference parsing implementation, using recursive descent, to +compare the parsing results. + +This is mostly based on the explanation found at this address: +https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm (use the Wayback Machine to +read it). + +## How to build + +Simply launch the following command + +```sh +42sh$ make +``` + +If you want to build an `evalexpr` command using recursive descent instead, use: + +```sh +42sh$ make USE_CLIMBING=0 +``` + +Don't forget to use `make clean` when alternating between both. + + +## How to use + +Simply launch the binary, and write an expression on its standard input. The +binary can parse exactly one expression per line, and reports parsing errors if +they happen. + +Example use: + +```none +42sh$ ./evalexpr +1 + 2 * 3 - 3! +1 +```