added POSIX AWK port
This commit is contained in:
+4
-2
@@ -24,7 +24,7 @@ Initial values:
|
||||
* `PROGMEM` = empty
|
||||
* `VARS["A"]..VARS["Z"] = 0`
|
||||
* `CALLSTACK` = empty
|
||||
* `IP` = 0
|
||||
* `IP = 0`
|
||||
|
||||
## Overall interpreter session flow
|
||||
|
||||
@@ -90,6 +90,8 @@ Simple two-value evaluator. Accepts two stacks, value stack `VALSTACK` and opera
|
||||
|
||||
Mathematical expression and intrinsic function application engine. Accepts a single `EXPR` string as a parameter.
|
||||
|
||||
Requires a precedence map `PRECMAP` to be pre-defined as follows: `"(" => 0, "+" => 1, "-" => 1, "*" => 2, "/" => 2, "$" => 3`.
|
||||
|
||||
1. Trim leading/trailing whitespace from `EXPR`.
|
||||
2. If `EXPR` is empty, return 0.
|
||||
3. Initialize `VALSTACK` and `OPSTACK` as empty stacks.
|
||||
@@ -198,7 +200,7 @@ Value and string printing routine. Accepts `STMT` string as a parameter.
|
||||
1. Initialize an empty list `PRINTLIST` and an empty string buffer `ITEM`.
|
||||
2. Set the `QUOTING` flag to 0.
|
||||
3. Fetch the next character `C` from `STMT`. Go to step 10 if there are no more characters.
|
||||
4. If `C` is a double quote `"`, then flip the `QUOTING` flag (set `QUOTING = 1 - QUOTING`), append the value of `C` to `ITEM` and go to step 3. Otherwise, go to step 6.
|
||||
4. If `C` is a double quote `"`, then flip the `QUOTING` flag (set `QUOTING = 1 - QUOTING`), append the value of `C` to `ITEM` and go to step 3. Otherwise, go to step 5.
|
||||
5. If the `QUOTING` flag is set, append the value of `C` to `ITEM` and go to step 3.
|
||||
6. If `C` is either a comma (`,`) or a semicolon (`;`), go to step 7, otherwise go to step 9.
|
||||
7. If the current `ITEM` value is not empty, append it to the `PRINTLIST` and clear the `ITEM` variable.
|
||||
|
||||
Reference in New Issue
Block a user