easycoder 5__tar.gz → 241211.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of easycoder might be problematic. Click here for more details.
- easycoder-241211.1/PKG-INFO +71 -0
- easycoder-241211.1/README.md +60 -0
- easycoder-241211.1/doc/core/add.md +13 -0
- easycoder-241211.1/doc/core/append.md +13 -0
- easycoder-241211.1/doc/core/assert.md +11 -0
- easycoder-241211.1/doc/core/begin.md +15 -0
- easycoder-241211.1/doc/core/clear.md +13 -0
- easycoder-241211.1/doc/core/close.md +11 -0
- easycoder-241211.1/doc/core/create.md +11 -0
- easycoder-241211.1/doc/core/debug.md +16 -0
- easycoder-241211.1/doc/core/decrement.md +11 -0
- easycoder-241211.1/doc/core/delete.md +16 -0
- easycoder-241211.1/doc/core/divide.md +14 -0
- easycoder-241211.1/doc/core/exit.md +11 -0
- easycoder-241211.1/doc/core/file.md +14 -0
- easycoder-241211.1/doc/core/fork.md +13 -0
- easycoder-241211.1/doc/core/get.md +15 -0
- easycoder-241211.1/doc/core/go.md +13 -0
- easycoder-241211.1/doc/core/gosub.md +12 -0
- easycoder-241211.1/doc/core/if.md +14 -0
- easycoder-241211.1/doc/core/increment.md +13 -0
- easycoder-241211.1/doc/core/index.md +15 -0
- easycoder-241211.1/doc/core/init.md +14 -0
- easycoder-241211.1/doc/core/input.md +13 -0
- easycoder-241211.1/doc/core/multiply.md +14 -0
- easycoder-241211.1/doc/core/open.md +25 -0
- easycoder-241211.1/doc/core/pop.md +12 -0
- easycoder-241211.1/doc/core/post.md +17 -0
- easycoder-241211.1/doc/core/print.md +14 -0
- easycoder-241211.1/doc/core/push.md +13 -0
- easycoder-241211.1/doc/core/put.md +13 -0
- easycoder-241211.1/doc/core/read.md +12 -0
- easycoder-241211.1/doc/core/replace.md +13 -0
- easycoder-241211.1/doc/core/return.md +12 -0
- easycoder-241211.1/doc/core/script.md +12 -0
- easycoder-241211.1/doc/core/set.md +25 -0
- easycoder-241211.1/doc/core/split.md +13 -0
- easycoder-241211.1/doc/core/stack.md +13 -0
- easycoder-241211.1/doc/core/stop.md +15 -0
- easycoder-241211.1/doc/core/system.md +13 -0
- easycoder-241211.1/doc/core/take.md +15 -0
- easycoder-241211.1/doc/core/toggle.md +13 -0
- easycoder-241211.1/doc/core/truncate.md +14 -0
- easycoder-241211.1/doc/core/variable.md +15 -0
- easycoder-241211.1/doc/core/wait.md +18 -0
- easycoder-241211.1/doc/core/while.md +20 -0
- easycoder-241211.1/doc/core/write.md +13 -0
- easycoder-241211.1/doc/core.md +12 -0
- {easycoder-5 → easycoder-241211.1}/easycoder/__init__.py +1 -1
- {easycoder-5 → easycoder-241211.1}/easycoder/ec_compiler.py +2 -4
- {easycoder-5 → easycoder-241211.1}/easycoder/ec_condition.py +2 -2
- {easycoder-5 → easycoder-241211.1}/easycoder/ec_core.py +68 -26
- {easycoder-5 → easycoder-241211.1}/easycoder/ec_program.py +30 -18
- {easycoder-5 → easycoder-241211.1}/easycoder/ec_value.py +2 -3
- {easycoder-5 → easycoder-241211.1}/plugins/ec_p100.py +1 -1
- easycoder-241211.1/scripts/hello.ecs +1 -0
- easycoder-241211.1/test.ecs +10 -0
- easycoder-5/PKG-INFO +0 -79
- easycoder-5/README.md +0 -68
- {easycoder-5 → easycoder-241211.1}/LICENSE +0 -0
- {easycoder-5 → easycoder-241211.1}/easycoder/ec_classes.py +0 -0
- {easycoder-5 → easycoder-241211.1}/easycoder/ec_handler.py +0 -0
- {easycoder-5 → easycoder-241211.1}/easycoder/ec_timestamp.py +0 -0
- {easycoder-5 → easycoder-241211.1}/pyproject.toml +0 -0
- {easycoder-5 → easycoder-241211.1}/scripts/benchmark.ecs +0 -0
- {easycoder-5 → easycoder-241211.1}/scripts/fizzbuzz.ecs +0 -0
- {easycoder-5 → easycoder-241211.1}/scripts/tests.ecs +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: easycoder
|
|
3
|
+
Version: 241211.1
|
|
4
|
+
Summary: EasyCoder for Python
|
|
5
|
+
Author-email: Graham Trott <gtanyware@gmail.com>
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Requires-Dist: pytz
|
|
9
|
+
Project-URL: Home, https://github.com/easycoder
|
|
10
|
+
|
|
11
|
+
# Introduction
|
|
12
|
+
This is the Python version of **_EasyCoder_**, a high-level English-like scripting language suited for prototyping and rapid testing of ideas. It operates on the command line.
|
|
13
|
+
|
|
14
|
+
The JavaScript version of **_EasyCoder_**, which provides a full set of graphical features to run in a browser, is at
|
|
15
|
+
|
|
16
|
+
Repository: [https://github.com/easycoder/easycoder.github.io](https://github.com/easycoder/easycoder.github.io)
|
|
17
|
+
Website: [https://easycoder.github.io](https://easycoder.github.io)
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
Install **_EasyCoder_** in your Python environment:
|
|
21
|
+
```
|
|
22
|
+
pip install easycoder
|
|
23
|
+
```
|
|
24
|
+
Write a test script, 'hello.ecs', containing the following:
|
|
25
|
+
```
|
|
26
|
+
print `Hello, world!`
|
|
27
|
+
```
|
|
28
|
+
This is traditionally the first program to be written in virtually any language. To run it, use `easycoder hello.ecs`.
|
|
29
|
+
|
|
30
|
+
The output will look like this:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
EasyCoder version 5
|
|
34
|
+
Compiled <anon>: 1 lines (2 tokens) in 0 ms
|
|
35
|
+
Run <anon>
|
|
36
|
+
1-> Hello, world!
|
|
37
|
+
```
|
|
38
|
+
It's conventional to add a program title to a script:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
! Test script
|
|
42
|
+
script Test
|
|
43
|
+
print `Hello, world!`
|
|
44
|
+
```
|
|
45
|
+
The first line here is just a comment and has no effect on the running of the script. The second line gives the script a name, which is useful in debugging as it says which script was running. When run, the output is now
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
EasyCoder version 5
|
|
49
|
+
Compiled Test: 5 lines (4 tokens) in 0 ms
|
|
50
|
+
Run Test
|
|
51
|
+
5-> Hello, world!
|
|
52
|
+
```
|
|
53
|
+
As you can guess from the above, the print command gives the line in the script it was called from. This is very useful in tracking down debugging print commands in large scripts.
|
|
54
|
+
|
|
55
|
+
Here in the repository is a folder called `scripts` containing some sample scripts:
|
|
56
|
+
|
|
57
|
+
`benchmark.ecs` allows the performance of EasyCoder to be compared to other languages if a similar program is written for each one
|
|
58
|
+
`tests.ecs` is a test program containing many of the EasyCoder features
|
|
59
|
+
`fizzbuzz.ecs` is a simple programming challenge often given at job interviews
|
|
60
|
+
|
|
61
|
+
## The EasyCoder programming language
|
|
62
|
+
There are three primary components to the language:
|
|
63
|
+
|
|
64
|
+
- Keywords
|
|
65
|
+
- Values
|
|
66
|
+
- Conditions
|
|
67
|
+
|
|
68
|
+
The language comprises a general-purpose core package, which can be enhanced by plugins to provide special features on demand.
|
|
69
|
+
|
|
70
|
+
[The core package](doc/core.md)
|
|
71
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
This is the Python version of **_EasyCoder_**, a high-level English-like scripting language suited for prototyping and rapid testing of ideas. It operates on the command line.
|
|
3
|
+
|
|
4
|
+
The JavaScript version of **_EasyCoder_**, which provides a full set of graphical features to run in a browser, is at
|
|
5
|
+
|
|
6
|
+
Repository: [https://github.com/easycoder/easycoder.github.io](https://github.com/easycoder/easycoder.github.io)
|
|
7
|
+
Website: [https://easycoder.github.io](https://easycoder.github.io)
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
Install **_EasyCoder_** in your Python environment:
|
|
11
|
+
```
|
|
12
|
+
pip install easycoder
|
|
13
|
+
```
|
|
14
|
+
Write a test script, 'hello.ecs', containing the following:
|
|
15
|
+
```
|
|
16
|
+
print `Hello, world!`
|
|
17
|
+
```
|
|
18
|
+
This is traditionally the first program to be written in virtually any language. To run it, use `easycoder hello.ecs`.
|
|
19
|
+
|
|
20
|
+
The output will look like this:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
EasyCoder version 5
|
|
24
|
+
Compiled <anon>: 1 lines (2 tokens) in 0 ms
|
|
25
|
+
Run <anon>
|
|
26
|
+
1-> Hello, world!
|
|
27
|
+
```
|
|
28
|
+
It's conventional to add a program title to a script:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
! Test script
|
|
32
|
+
script Test
|
|
33
|
+
print `Hello, world!`
|
|
34
|
+
```
|
|
35
|
+
The first line here is just a comment and has no effect on the running of the script. The second line gives the script a name, which is useful in debugging as it says which script was running. When run, the output is now
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
EasyCoder version 5
|
|
39
|
+
Compiled Test: 5 lines (4 tokens) in 0 ms
|
|
40
|
+
Run Test
|
|
41
|
+
5-> Hello, world!
|
|
42
|
+
```
|
|
43
|
+
As you can guess from the above, the print command gives the line in the script it was called from. This is very useful in tracking down debugging print commands in large scripts.
|
|
44
|
+
|
|
45
|
+
Here in the repository is a folder called `scripts` containing some sample scripts:
|
|
46
|
+
|
|
47
|
+
`benchmark.ecs` allows the performance of EasyCoder to be compared to other languages if a similar program is written for each one
|
|
48
|
+
`tests.ecs` is a test program containing many of the EasyCoder features
|
|
49
|
+
`fizzbuzz.ecs` is a simple programming challenge often given at job interviews
|
|
50
|
+
|
|
51
|
+
## The EasyCoder programming language
|
|
52
|
+
There are three primary components to the language:
|
|
53
|
+
|
|
54
|
+
- Keywords
|
|
55
|
+
- Values
|
|
56
|
+
- Conditions
|
|
57
|
+
|
|
58
|
+
The language comprises a general-purpose core package, which can be enhanced by plugins to provide special features on demand.
|
|
59
|
+
|
|
60
|
+
[The core package](doc/core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`add {value} to {variable}`
|
|
3
|
+
`add {value} to {value} giving {variable}`
|
|
4
|
+
## Examples:
|
|
5
|
+
`add 1 to N`
|
|
6
|
+
`add N to Count giving Total`
|
|
7
|
+
## Description:
|
|
8
|
+
Adds a numeric value to a numeric variable or adds two values and puts the result into a variable. See elsewhere in this documentation for an explanation of what is meant by a value. If you add to a variable it must already hold a numeric value, and if you assign a variable to hold the result of an addition it will lose whatever value it previously held.
|
|
9
|
+
|
|
10
|
+
Next: [append](append.md)
|
|
11
|
+
Prev: [write](write.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`append {value} to {array}`
|
|
3
|
+
## Examples:
|
|
4
|
+
`put empty into ItemArray`
|
|
5
|
+
`append `First value` to ItemArray`
|
|
6
|
+
`append `Second value` to ItemArray`
|
|
7
|
+
## Description:
|
|
8
|
+
Appends an item to a JSON array, which is is a string value held in a single variable element (not to be confused with a multi-element variable). See also [element](element.md).
|
|
9
|
+
|
|
10
|
+
Next: [assert](assert.md)
|
|
11
|
+
Prev: [add](add.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`begin ... end`
|
|
3
|
+
## Examples:
|
|
4
|
+
`if Flag`
|
|
5
|
+
`begin`
|
|
6
|
+
` add 1 to Counter`
|
|
7
|
+
` set Repeat`
|
|
8
|
+
`end`
|
|
9
|
+
## Description:
|
|
10
|
+
`begin` introduces a compound statement; a block of commands that start with `begin` and finish with `end`. The entire block is treated as a single statement and `end` marks the end of the compound statement block.
|
|
11
|
+
|
|
12
|
+
Next: [clear](clear.md)
|
|
13
|
+
Prev: [assert](assert.md)
|
|
14
|
+
|
|
15
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`clear {variable}`
|
|
3
|
+
|
|
4
|
+
## Examples:
|
|
5
|
+
`clear Flag`
|
|
6
|
+
|
|
7
|
+
## Description:
|
|
8
|
+
`clear` sets the value of the [variable](variable.md) to the Boolean value `false`. See also [set](set.md).
|
|
9
|
+
|
|
10
|
+
Next: [close](close.md)
|
|
11
|
+
Prev: [begin](begin.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`debug step/stop/program`
|
|
3
|
+
## Examples:
|
|
4
|
+
`debug step`
|
|
5
|
+
`debug stop`
|
|
6
|
+
`debug program`
|
|
7
|
+
## Description:
|
|
8
|
+
Set up a debug option.
|
|
9
|
+
`debug step` causes the runtime to display each line before it executes it
|
|
10
|
+
`debug stop` cancels `debug step`
|
|
11
|
+
`debug program` displays the entire program
|
|
12
|
+
|
|
13
|
+
Next: [decrement](decrement.md)
|
|
14
|
+
Prev: [create](create.md)
|
|
15
|
+
|
|
16
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`delete {filename}`
|
|
3
|
+
`delete property {value} of {variable}`
|
|
4
|
+
|
|
5
|
+
## Examples:
|
|
6
|
+
`delete file {filename}`
|
|
7
|
+
``delete property `name` of Record``
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
The first form deletes the file whose full or relative path is given.
|
|
11
|
+
The second form deletes a named property of an object. See also [set property](set.md).
|
|
12
|
+
|
|
13
|
+
Next: [divide](divide.md)
|
|
14
|
+
Prev: [decrement](decrement.md)
|
|
15
|
+
|
|
16
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`divide {value} by {variable}`
|
|
3
|
+
`divide {value} by {value} giving {variable}`
|
|
4
|
+
## Examples:
|
|
5
|
+
`divide Count by 2`
|
|
6
|
+
`divide Count by N`
|
|
7
|
+
`divide Count by N giving Total`
|
|
8
|
+
## Description:
|
|
9
|
+
Divides a numeric variable by a numeric value or divides one value by another and puts the result into a variable. See elsewhere in this documentation for an explanation of what is meant by a value. If you divide a variable it must already hold a numeric value, and if you assign a variable to hold the result of a division it will lose whatever value it previously held.
|
|
10
|
+
|
|
11
|
+
Next: [exit](exit.md)
|
|
12
|
+
Prev: [delete](delete.md)
|
|
13
|
+
|
|
14
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`file {name}`
|
|
3
|
+
## Example:
|
|
4
|
+
`file InputFile`
|
|
5
|
+
``open InputFile `mydata.txt` for reading``
|
|
6
|
+
`read Data from InputFile`
|
|
7
|
+
`close InputFile`
|
|
8
|
+
## Description:
|
|
9
|
+
Declare a file variable. See [open](open.md), [read](read.md), [write](write.md) and [close](close.md).
|
|
10
|
+
|
|
11
|
+
Next: [fork](fork.md)
|
|
12
|
+
Prev: [exit](exit.md)
|
|
13
|
+
|
|
14
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`fork to {label}`
|
|
3
|
+
## Examples:
|
|
4
|
+
`fork to RunBackgroundTask`
|
|
5
|
+
## Description:
|
|
6
|
+
`fork` is a special kind of [goto](goto.md), that causes the program to execute from the given label but also continue executing at the next command. The multitasking implied in this is handled by EasyCoder. Python programmers will know that the language is single threaded, so a cooperative technique is used internally to create the illusion of true multitasking.
|
|
7
|
+
|
|
8
|
+
When `fork` is used, the forked commands run until they reach a [stop](stop.md) or [wait](wait.md), then execution resumes at the command following the `fork`. If your forked commands comprise a loop, be sure to put in a short delay ([wait](wait.md)) to allow other 'processes' to get some CPU time.
|
|
9
|
+
|
|
10
|
+
Next: [get](get.md)
|
|
11
|
+
Prev: [exit](exit.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`get {variable from {url} [or {command}]}`
|
|
3
|
+
|
|
4
|
+
## Examples:
|
|
5
|
+
`get Content from Path`
|
|
6
|
+
``get Content from `https://myserver.com/testdata.txt` ``
|
|
7
|
+
``get Content from `https://myserver.com/testdata.txt` or goto AbandonShip``
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Perform an HTTP GET to request data. In the second example, if the request fails some appropriate action can be taken.
|
|
11
|
+
|
|
12
|
+
Next: [gosub](gosub.md)
|
|
13
|
+
Prev: [fork](fork.md)
|
|
14
|
+
|
|
15
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`go [to] {label}`
|
|
3
|
+
`goto {label}`
|
|
4
|
+
## Examples:
|
|
5
|
+
`go to Step5`
|
|
6
|
+
`goto Step5`
|
|
7
|
+
## Description:
|
|
8
|
+
`gosub` is like go in that it transfers control to the named label. However, when the program encounters a `return` command, execution resumes at the command following the `gosub`.
|
|
9
|
+
|
|
10
|
+
Next: [gosub](gosub.md)
|
|
11
|
+
Prev: [get](get.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`gosub [to] {label}`
|
|
3
|
+
## Examples:
|
|
4
|
+
`gosub CheckValues`
|
|
5
|
+
`gosub to CheckValues`
|
|
6
|
+
## Description:
|
|
7
|
+
`gosub` is like `go` in that it transfers control to the named label. However, when the program encounters a `return` command, execution resumes at the command following the `gosub`.
|
|
8
|
+
|
|
9
|
+
Next: [if](if.md)
|
|
10
|
+
Prev: [go](go.md)
|
|
11
|
+
|
|
12
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`if {condition} {true-outcome} [else {false-outcome}]`
|
|
3
|
+
|
|
4
|
+
## Examples:
|
|
5
|
+
`if Value1 is greater than Value2 put true into Result`
|
|
6
|
+
``if Remaining is 0 print 'Finished` else add Remaining to ItemCount``
|
|
7
|
+
|
|
8
|
+
## Description:
|
|
9
|
+
`if` tests the condition that follows. If the result is `true` then control resumes at the named label; otherwise if there's an `else` section this is executed, then the program resumes at the next instruction after the `if`. See also [while](while.md).
|
|
10
|
+
|
|
11
|
+
Next: [increment](increment.md)
|
|
12
|
+
Prev: [gosub](gosub.md)
|
|
13
|
+
|
|
14
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`index {variable} to {value}`
|
|
3
|
+
|
|
4
|
+
## Examples:
|
|
5
|
+
`set the elements of List to 10`
|
|
6
|
+
`index List to 5`
|
|
7
|
+
`put Result into List`
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
`index` is a special command for array handling. In EasyCoder, all variables are arrays. Initially they only have one element but you can [set](set.md) an array to have as many elements as you like, using `set the elements of {variable} to {value}`. Inside each array is the current index for the array, which you can set to any value within the number of elements in the array. The array is still used as if it were a simple variable and only the element pointed to by the index is affected by whatever you do with the array. Where multitasking is used - with [fork](fork.md) or by handling an event - you must be careful to set the index before using the array if there's any chance it may have been modified by another thread.
|
|
11
|
+
|
|
12
|
+
Next: [init](init.md)
|
|
13
|
+
Prev: [increment](increment.md)
|
|
14
|
+
|
|
15
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`init {stack}`
|
|
3
|
+
|
|
4
|
+
## Examples:
|
|
5
|
+
`stack ValueStack`
|
|
6
|
+
`init ValueStack`
|
|
7
|
+
|
|
8
|
+
## Description:
|
|
9
|
+
`init` initialises a [stack](stack.md) - an array object, so that values can be [push](push.md)ed to it and [pop](pop.md)ped from it. A [stack](stack.md) is a convenient place to store values during recursive operations.
|
|
10
|
+
|
|
11
|
+
Next: [input](input.md)
|
|
12
|
+
Prev: [index](index.md)
|
|
13
|
+
|
|
14
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`input {variable} [with {prompt}]`
|
|
3
|
+
## Examples:
|
|
4
|
+
`input MyName`
|
|
5
|
+
`input MyName with Prompt`
|
|
6
|
+
``input MyName with `Please type your name` ``
|
|
7
|
+
## Description:
|
|
8
|
+
`input` lets the user provide data from the keyboard, with an optional prompt string.
|
|
9
|
+
|
|
10
|
+
Next: [multiply](multiply.md)
|
|
11
|
+
Prev: [init](init.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`multiply {value} by {variable}`
|
|
3
|
+
`multiply {value} by {value} giving {variable}`
|
|
4
|
+
## Examples:
|
|
5
|
+
`multiply Count by 2`
|
|
6
|
+
`multiply Count by N`
|
|
7
|
+
`divide Count by N giving Total`
|
|
8
|
+
## Description:
|
|
9
|
+
Multiplies a numeric variable by a numeric value or multiplies one value by another and puts the result into a variable. See elsewhere in this documentation for an explanation of what is meant by a value. If you multiply a variable it must already hold a numeric value, and if you assign a variable to hold the result of a multiplication it will lose whatever value it previously held.
|
|
10
|
+
|
|
11
|
+
Next: [open](open.md)
|
|
12
|
+
Prev: [input](input.md)
|
|
13
|
+
|
|
14
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`open {file} {path} for reading/writing/appending`
|
|
3
|
+
## Example:
|
|
4
|
+
`file File1`
|
|
5
|
+
`file File2`
|
|
6
|
+
`file File3`
|
|
7
|
+
|
|
8
|
+
``open File1 `oldvalues.txt` for reading``
|
|
9
|
+
``open File2 `newvalues.txt` for writing``
|
|
10
|
+
`read Value from File1`
|
|
11
|
+
`write Value to File2`
|
|
12
|
+
`close File2`
|
|
13
|
+
`close File1`
|
|
14
|
+
|
|
15
|
+
``open File3 `somefile.txt` for appending``
|
|
16
|
+
``write `some data` to File3``
|
|
17
|
+
`close File3`
|
|
18
|
+
|
|
19
|
+
## Description:
|
|
20
|
+
Opens a disk file for reading, writing or appending. Each of the [file](file.md) variables must be declared as such as in the example.
|
|
21
|
+
|
|
22
|
+
Next: [pop](pop.md)
|
|
23
|
+
Prev: [multiply](multiply.md)
|
|
24
|
+
|
|
25
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`post {value} to {url} [giving {variable}] [or {command}]`
|
|
3
|
+
|
|
4
|
+
## Examples:
|
|
5
|
+
``post MyData to `https://myserver.com/rest` ``
|
|
6
|
+
`post MyData to MyServer`
|
|
7
|
+
`post stringify Data to MyServer giving Result`
|
|
8
|
+
`` post `reset` to MyServer``
|
|
9
|
+
`post MyData to MyServer or go to AbandonShip`
|
|
10
|
+
|
|
11
|
+
## Description:
|
|
12
|
+
Perform an HTTP PUT request with the specified data and endpoint, optionally saving the value that returns and optionally trapping a failure.
|
|
13
|
+
|
|
14
|
+
Next: [print](print.md)
|
|
15
|
+
Prev: [pop](pop.md)
|
|
16
|
+
|
|
17
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`print {value}`
|
|
3
|
+
## Examples:
|
|
4
|
+
``print `Hello, world!` ``
|
|
5
|
+
`print Data cat newline`
|
|
6
|
+
|
|
7
|
+
## Description:
|
|
8
|
+
Print something to the terminal. The second example shows the use of string catenation, which is also covered in [values](../core.md).
|
|
9
|
+
The output is prefixed by the script line number of the print command. This is very useful in large scripts when trying to figure where print output is coming from.
|
|
10
|
+
|
|
11
|
+
Next: [push](push.md)
|
|
12
|
+
Prev: [post](post.md)
|
|
13
|
+
|
|
14
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`push {variable} to/onto {stack}`
|
|
3
|
+
## Examples:
|
|
4
|
+
``push `Hello, world!` to DataStack``
|
|
5
|
+
`push Value onto ValueStack`
|
|
6
|
+
|
|
7
|
+
## Description:
|
|
8
|
+
Push something onto the specified [stack](stack.md).
|
|
9
|
+
|
|
10
|
+
Next: [put](put.md)
|
|
11
|
+
Prev: [print](print.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`put {value} into {variable}`
|
|
3
|
+
## Examples:
|
|
4
|
+
``put `Hello, world!` into Message``
|
|
5
|
+
`put Message cat newline into Message`
|
|
6
|
+
|
|
7
|
+
## Description:
|
|
8
|
+
Put a value into a [variable](variable.md). The second example illustrates how to append to a string.
|
|
9
|
+
|
|
10
|
+
Next: [read](read.md)
|
|
11
|
+
Prev: [push](push.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`read {value} from {file}`
|
|
3
|
+
## Examples:
|
|
4
|
+
`read Value from MyFile`
|
|
5
|
+
|
|
6
|
+
## Description:
|
|
7
|
+
Read a value from a [file](file.md). See [open](open.md), [write](write.md) and [close](close.md).
|
|
8
|
+
|
|
9
|
+
Next: [replace](replace.md)
|
|
10
|
+
Prev: [put](put.md)
|
|
11
|
+
|
|
12
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`replace {value} with {value} in {variable}`
|
|
3
|
+
## Examples:
|
|
4
|
+
``replace `one` with `two` in Sentence``
|
|
5
|
+
`replace Template with Value in Text`
|
|
6
|
+
|
|
7
|
+
## Description:
|
|
8
|
+
Replaces all occurrences of one string with another in a string [variable](variable.md).
|
|
9
|
+
|
|
10
|
+
Next: [return](return.md)
|
|
11
|
+
Prev: [read](read.md)
|
|
12
|
+
|
|
13
|
+
[Back](../core.md)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`set {variable}`
|
|
3
|
+
`set the elements of {variable} to {value}`
|
|
4
|
+
`set element/property {name} of {variable} to {value}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`set Flag`
|
|
8
|
+
`set the elements of ThisVariable to 10`
|
|
9
|
+
`set element 5 of MyList to NewValue`
|
|
10
|
+
``set property `name` of MyProperties to `first` ``
|
|
11
|
+
``set property `age` of MyProperties to Age``
|
|
12
|
+
|
|
13
|
+
## Description:
|
|
14
|
+
`set` is a heavily used command in **_EasyCoder_**. Here in the core package it does the following, as listed in the Syntax above:
|
|
15
|
+
|
|
16
|
+
-- assigns the boolean true value to the named [variable](variable.md). See also [clear](clear.md) and [toggle](toggle.md).
|
|
17
|
+
|
|
18
|
+
-- assigns a specified number of elements to a variable - see [index](index.md). When used to change the size of an array the command preserves all elements that are not affected by the size change.
|
|
19
|
+
|
|
20
|
+
-- Sets an element or a property of a [variable](variable.md), providing it was intialised appropriately. Elements can be added to a variable that is intialised as JSON list, for example as ``put json `[]` into MyList``. Properties can be set on a variable that is initialised as a JSON object, for example as ``put json `{}` into MyProperties``. Note that this has nothing to do with the indexing of variables using [index](index.md). Each of the elements of such a variable can be treated as either a JSON list or as a JSON object, and either can be used for different elements of the same variable.
|
|
21
|
+
|
|
22
|
+
Next: [split](split.md)
|
|
23
|
+
Prev: [script](script.md)
|
|
24
|
+
|
|
25
|
+
[Back](../core.md)
|