From 214bf2ec1113e536abed4f5e11a407a22928e995 Mon Sep 17 00:00:00 2001 From: Jake Roggenbuck <35516367+JakeRoggenbuck@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:47:56 -0700 Subject: [PATCH 1/2] Update README.md --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index 7de426a..c480a1d 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,53 @@ The code for Component and Basis use the same lexer. Component is mainly differe Note that the symbol `>` is used in code example to show that these expressions are being put into a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) and evaluated. These symbols at the start of the expression are not apart of the syntax. +## Guide + +Component uses Postfix Notation. +Postfix Notion has the arguments first, and then the function or operation. +In the below example, we are adding 1 and 2 with the + operator to get 3. +Try typing the following into the interactive prompt: +``` +1 2 + +``` +It should look this this once it's been typed in and you press enter: +``` +> 1 2 + +-> 3 +``` + +Component has a lot of the operators you would expect from math and other languages: +``` ++ addition +- subtraction +* mltiplication +/ division +^ exponentiation +``` + +Some that may be familar from other languages: +``` +! logical not +``` + +And some that may not be as familar: +``` +? conditional assignment +``` + +Component also has functions that can be called in the same was as operators: +``` +sqrt square root +``` + +And build in constants: +``` +e Euler's number +C Speed of light in m/s +pi Pi +true and false +``` + ## Keywords - `int` converts types into NumericIntLiteral if possible From bdcdebb6ad6bf981b0d23a98ae5643d56dfdd0be Mon Sep 17 00:00:00 2001 From: Jake Roggenbuck <35516367+JakeRoggenbuck@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:49:09 -0700 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c480a1d..4a97cfa 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ pi Pi true and false ``` -## Keywords +## Full List of Keywords - `int` converts types into NumericIntLiteral if possible - `dec` converts types into NumericDecLiteral if possible