easycoder 241211.3__tar.gz → 250116.3__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-250116.3/PKG-INFO +116 -0
- easycoder-250116.3/README.md +104 -0
- easycoder-250116.3/doc/README.md +7 -0
- easycoder-250116.3/doc/core/README.md +23 -0
- easycoder-250116.3/doc/core/conditions/boolean.md +16 -0
- easycoder-250116.3/doc/core/conditions/empty.md +15 -0
- easycoder-250116.3/doc/core/conditions/ends.md +15 -0
- easycoder-250116.3/doc/core/conditions/even.md +15 -0
- easycoder-250116.3/doc/core/conditions/exists.md +15 -0
- easycoder-250116.3/doc/core/conditions/greater.md +16 -0
- easycoder-250116.3/doc/core/conditions/hasProperty.md +15 -0
- easycoder-250116.3/doc/core/conditions/includes.md +15 -0
- easycoder-250116.3/doc/core/conditions/is.md +15 -0
- easycoder-250116.3/doc/core/conditions/less.md +16 -0
- easycoder-250116.3/doc/core/conditions/list.md +15 -0
- easycoder-250116.3/doc/core/conditions/none.md +15 -0
- easycoder-250116.3/doc/core/conditions/not.md +15 -0
- easycoder-250116.3/doc/core/conditions/numeric.md +15 -0
- easycoder-250116.3/doc/core/conditions/object.md +15 -0
- easycoder-250116.3/doc/core/conditions/odd.md +15 -0
- easycoder-250116.3/doc/core/conditions/starts.md +15 -0
- easycoder-250116.3/doc/core/conditions/string.md +15 -0
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/add.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/append.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/assert.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/begin.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/clear.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/close.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/create.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/debug.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/decrement.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/delete.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/divide.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/exit.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/file.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/fork.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/get.md +4 -2
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/go.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/gosub.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/if.md +4 -2
- easycoder-250116.3/doc/core/keywords/import.md +21 -0
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/increment.md +4 -2
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/index.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/init.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/input.md +4 -2
- easycoder-250116.3/doc/core/keywords/load.md +16 -0
- easycoder-250116.3/doc/core/keywords/lock.md +15 -0
- easycoder-250116.3/doc/core/keywords/module.md +17 -0
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/multiply.md +5 -3
- easycoder-250116.3/doc/core/keywords/negate.md +13 -0
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/open.md +4 -2
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/pop.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/post.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/print.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/push.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/put.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/read.md +4 -2
- easycoder-250116.3/doc/core/keywords/release.md +15 -0
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/replace.md +4 -2
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/return.md +4 -2
- easycoder-250116.3/doc/core/keywords/run.md +15 -0
- easycoder-250116.3/doc/core/keywords/save.md +16 -0
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/script.md +4 -2
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/set.md +10 -4
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/split.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/stack.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/stop.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/system.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/take.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/toggle.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/truncate.md +4 -2
- easycoder-250116.3/doc/core/keywords/unlock.md +15 -0
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/variable.md +4 -2
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/wait.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/while.md +3 -1
- {easycoder-241211.3/doc/core → easycoder-250116.3/doc/core/keywords}/write.md +3 -1
- easycoder-250116.3/doc/core/values/arg.md +16 -0
- easycoder-250116.3/doc/core/values/args.md +15 -0
- easycoder-250116.3/doc/core/values/cos.md +16 -0
- easycoder-250116.3/doc/core/values/datime.md +17 -0
- easycoder-250116.3/doc/core/values/decode.md +15 -0
- easycoder-250116.3/doc/core/values/element.md +16 -0
- easycoder-250116.3/doc/core/values/elements.md +15 -0
- easycoder-250116.3/doc/core/values/empty.md +15 -0
- easycoder-250116.3/doc/core/values/encode.md +15 -0
- easycoder-250116.3/doc/core/values/error.md +16 -0
- easycoder-250116.3/doc/core/values/files.md +15 -0
- easycoder-250116.3/doc/core/values/float.md +16 -0
- easycoder-250116.3/doc/core/values/from.md +17 -0
- easycoder-250116.3/doc/core/values/hash.md +16 -0
- easycoder-250116.3/doc/core/values/index.md +19 -0
- easycoder-250116.3/doc/core/values/integer.md +15 -0
- easycoder-250116.3/doc/core/values/json.md +15 -0
- easycoder-250116.3/doc/core/values/keys.md +15 -0
- easycoder-250116.3/doc/core/values/left.md +15 -0
- easycoder-250116.3/doc/core/values/length.md +15 -0
- easycoder-250116.3/doc/core/values/lowercase.md +15 -0
- easycoder-250116.3/doc/core/values/memory.md +15 -0
- easycoder-250116.3/doc/core/values/modification.md +15 -0
- easycoder-250116.3/doc/core/values/modulo.md +15 -0
- easycoder-250116.3/doc/core/values/newline.md +15 -0
- easycoder-250116.3/doc/core/values/now.md +15 -0
- easycoder-250116.3/doc/core/values/position.md +15 -0
- easycoder-250116.3/doc/core/values/property.md +15 -0
- easycoder-250116.3/doc/core/values/random.md +16 -0
- easycoder-250116.3/doc/core/values/right.md +15 -0
- easycoder-250116.3/doc/core/values/sin.md +16 -0
- easycoder-250116.3/doc/core/values/stringify.md +15 -0
- easycoder-250116.3/doc/core/values/tab.md +15 -0
- easycoder-250116.3/doc/core/values/tan.md +16 -0
- easycoder-250116.3/doc/core/values/timestamp.md +18 -0
- easycoder-250116.3/doc/core/values/today.md +15 -0
- easycoder-250116.3/doc/core/values/trim.md +15 -0
- easycoder-250116.3/doc/core/values/type.md +16 -0
- easycoder-250116.3/doc/core/values/uppercase.md +15 -0
- easycoder-250116.3/doc/core/values/value.md +15 -0
- easycoder-250116.3/doc/core/values/weekday.md +15 -0
- easycoder-250116.3/doc/graphics/README.md +22 -0
- easycoder-250116.3/doc/graphics/keywords/attach.md +18 -0
- easycoder-250116.3/doc/graphics/keywords/close.md +15 -0
- easycoder-250116.3/doc/graphics/keywords/create.md +15 -0
- easycoder-250116.3/doc/graphics/keywords/ellipse.md +15 -0
- easycoder-250116.3/doc/graphics/keywords/image.md +15 -0
- easycoder-250116.3/doc/graphics/keywords/move.md +17 -0
- easycoder-250116.3/doc/graphics/keywords/on.md +16 -0
- easycoder-250116.3/doc/graphics/keywords/rectangle.md +15 -0
- easycoder-250116.3/doc/graphics/keywords/render.md +18 -0
- easycoder-250116.3/doc/graphics/keywords/run.md +18 -0
- easycoder-250116.3/doc/graphics/keywords/set.md +15 -0
- easycoder-250116.3/doc/graphics/keywords/text.md +15 -0
- easycoder-250116.3/doc/graphics/values/attribute.md +15 -0
- easycoder-250116.3/doc/graphics/values/window.md +15 -0
- easycoder-250116.3/easycoder/README.md +6 -0
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/__init__.py +1 -1
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/ec_classes.py +3 -0
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/ec_compiler.py +11 -7
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/ec_core.py +493 -208
- easycoder-250116.3/easycoder/ec_graphics.py +274 -0
- easycoder-250116.3/easycoder/ec_gutils.py +52 -0
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/ec_handler.py +1 -0
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/ec_program.py +156 -79
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/ec_value.py +21 -14
- easycoder-250116.3/images/Semoigo Dawn.jpg +0 -0
- easycoder-250116.3/json/graphics-demo.json +74 -0
- easycoder-250116.3/plugins/ec_keyboard.py +205 -0
- {easycoder-241211.3 → easycoder-250116.3}/plugins/example.py +2 -1
- easycoder-250116.3/plugins/keyboards/4-function.json +62 -0
- easycoder-250116.3/plugins/keyboards/4-function.png +0 -0
- easycoder-250116.3/plugins/keyboards/qwerty-0.json +179 -0
- easycoder-250116.3/plugins/keyboards/qwerty-0.png +0 -0
- easycoder-250116.3/plugins/keyboards/qwerty-1.json +179 -0
- easycoder-250116.3/plugins/keyboards/qwerty-1.png +0 -0
- easycoder-250116.3/plugins/keyboards/qwerty-2.json +179 -0
- easycoder-250116.3/plugins/keyboards/qwerty-2.png +0 -0
- easycoder-250116.3/plugins/keyboards/qwerty-3.json +180 -0
- easycoder-250116.3/plugins/keyboards/qwerty-3.png +0 -0
- {easycoder-241211.3 → easycoder-250116.3}/pyproject.toml +4 -2
- easycoder-250116.3/scripts/README.md +16 -0
- {easycoder-241211.3 → easycoder-250116.3}/scripts/benchmark.ecs +1 -0
- easycoder-250116.3/scripts/ec_keyboard.py +191 -0
- {easycoder-241211.3 → easycoder-250116.3}/scripts/fizzbuzz.ecs +1 -0
- {easycoder-241211.3 → easycoder-250116.3}/scripts/hello.ecs +1 -0
- {easycoder-241211.3 → easycoder-250116.3}/scripts/points.ecs +2 -1
- easycoder-250116.3/scripts/test.ecs +12 -0
- easycoder-250116.3/scripts/testg.ecg +48 -0
- {easycoder-241211.3 → easycoder-250116.3}/scripts/tests.ecs +47 -1
- easycoder-241211.3/PKG-INFO +0 -72
- easycoder-241211.3/README.md +0 -61
- easycoder-241211.3/doc/README.md +0 -20
- easycoder-241211.3/test.ecs +0 -10
- {easycoder-241211.3 → easycoder-250116.3}/LICENSE +0 -0
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/ec_condition.py +0 -0
- {easycoder-241211.3 → easycoder-250116.3}/easycoder/ec_timestamp.py +0 -0
- {easycoder-241211.3 → easycoder-250116.3}/plugins/ec_p100.py +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: easycoder
|
|
3
|
+
Version: 250116.3
|
|
4
|
+
Summary: Rapid scripting in English
|
|
5
|
+
Keywords: compiler,scripting,prototyping,programming,coding,python,low code,hypertalk,computer language,learn to code
|
|
6
|
+
Author-email: Graham Trott <gtanyware@gmail.com>
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Requires-Dist: pytz
|
|
10
|
+
Project-URL: Home, https://github.com/easycoder/easycoder-py
|
|
11
|
+
|
|
12
|
+
# Introduction
|
|
13
|
+
**_EasyCoder_** is a high-level English-like scripting language suited for prototyping and rapid testing of ideas. It operates on the command line and a graphics module is under construction. This version of the language is written in Python and it acts as a fairly thin wrapper around Python functions, giving fast compilation and good runtime performance for general applications.
|
|
14
|
+
<hr>
|
|
15
|
+
|
|
16
|
+
There is also a JavaScript version of **_EasyCoder_**, which provides a full set of graphical features to run in a browser. For this, please visit
|
|
17
|
+
|
|
18
|
+
Repository: [https://github.com/easycoder/easycoder.github.io](https://github.com/easycoder/easycoder.github.io)
|
|
19
|
+
Website: [https://easycoder.github.io](https://easycoder.github.io)
|
|
20
|
+
<hr>
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
Install **_EasyCoder_** in your Python environment:
|
|
24
|
+
```
|
|
25
|
+
pip install requests pytz easycoder
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Test the install by typing the command `easycoder`.
|
|
29
|
+
<hr>
|
|
30
|
+
On Linux, this will probably fail as the installer places the executable file in the `$HOME/.local/bin` directory. So give the command
|
|
31
|
+
```
|
|
32
|
+
export PATH=$HOME/.local/bin:$PATH
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
To make this change permanent, edit your `.profile` file, adding the following:
|
|
36
|
+
```
|
|
37
|
+
# set PATH so it includes user's private .local/bin if it exists
|
|
38
|
+
if [ -d "$HOME/.local/bin" ] ; then
|
|
39
|
+
PATH="$HOME/.local/bin:$PATH"
|
|
40
|
+
fi
|
|
41
|
+
```
|
|
42
|
+
<hr>
|
|
43
|
+
|
|
44
|
+
Now write a test script, 'hello.ecs', containing the following:
|
|
45
|
+
```
|
|
46
|
+
print `Hello, world!`
|
|
47
|
+
```
|
|
48
|
+
(Note the backticks.) This is traditionally the first program to be written in virtually any language. To run it, use `easycoder hello.ecs`.
|
|
49
|
+
|
|
50
|
+
The output will look like this (the version number will differ):
|
|
51
|
+
```
|
|
52
|
+
EasyCoder version 250101.1
|
|
53
|
+
Compiled <anon>: 1 lines (2 tokens) in 0 ms
|
|
54
|
+
Run <anon>
|
|
55
|
+
1-> Hello, world!
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
It's conventional to add a program title to a script:
|
|
59
|
+
```
|
|
60
|
+
! Test script
|
|
61
|
+
script Test
|
|
62
|
+
print `Hello, world!`
|
|
63
|
+
```
|
|
64
|
+
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
|
|
65
|
+
```
|
|
66
|
+
EasyCoder version 250101.1
|
|
67
|
+
Compiled Test: 3 lines (4 tokens) in 0 ms
|
|
68
|
+
Run Test
|
|
69
|
+
3-> Hello, world!
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
As you might guess from the above, the print command shows the line in the script it was called from. This is very useful in tracking down debugging print commands in large scripts.
|
|
73
|
+
|
|
74
|
+
Here in the repository is a folder called `scripts` containing some sample scripts:
|
|
75
|
+
|
|
76
|
+
`fizzbuzz.ecs` is a simple programming challenge often given at job interviews
|
|
77
|
+
`tests.ecs` is a test program containing many of the **_EasyCoder_** features
|
|
78
|
+
`benchmark.ecs` allows the performance of **_EasyCoder_** to be compared to other languages if a similar script is written for each one.
|
|
79
|
+
|
|
80
|
+
## Graphical programmming
|
|
81
|
+
**_EasyCoder_** includes a graphical programming environment that is in the early stages of development. Some demo scripts will be included in the `scripts` directory; these can be recognised by the extension`.ecg`. To run them, first install `tkinter`. On Linux this is done with
|
|
82
|
+
```
|
|
83
|
+
sudo apt install python3-tk
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Next, install the Python `pySimpleGUI` graphics library; this is done with `pip install pysimplegui`. Then run your **_EasyCoder_** script using `easycoder {scriptname}.ecg`.
|
|
87
|
+
|
|
88
|
+
Graphical scripts look much like any other script but their file names must use the extension `.ecg` to signal to **_EasyCoder_** that it needs to load the graphics module. Non-graphical applications can use any extension but `.ecs` is recommended. This allows the **_EasyCoder_** application to be used wherever Python is installed, in either a command-line or a graphical environment, but graphics will of course not be available in the former.
|
|
89
|
+
|
|
90
|
+
Some demo graphical scripts will included in the `scripts` directory as development proceeds.
|
|
91
|
+
|
|
92
|
+
`gtest.ecg` contains sample code to demonstrate and test basic features.
|
|
93
|
+
|
|
94
|
+
## Significant features
|
|
95
|
+
|
|
96
|
+
- English-like syntax based on vocabulary rather than structure. Scripts can be read as English
|
|
97
|
+
- Comprehensive feature set
|
|
98
|
+
- Runs directly from source scripts. A fast compiler creates efficient intermediate code that runs immediately after compilation
|
|
99
|
+
- Low memory requirements
|
|
100
|
+
- Minimim dependency on other 3rd-party packages
|
|
101
|
+
- Built-in co-operative multitasking
|
|
102
|
+
- Dynamic loading of scripts on demand
|
|
103
|
+
- The language can be extended seamlessly using plugin function modules
|
|
104
|
+
- Plays well with any Python code
|
|
105
|
+
- Fully Open Source
|
|
106
|
+
|
|
107
|
+
## Programming reference
|
|
108
|
+
|
|
109
|
+
**_EasyCoder_** comprises a set of modules to handle tokenisation, compilation and runtime control. Syntax and grammar are defined by [packages](doc/README.md), of which there are currently two; the [core](doc/core/README.md) package, which implements a comprehensive set of command-line programming features, and and the [graphics](doc/graphics/README.md) package, which adds graphical features in a windowing environment.
|
|
110
|
+
|
|
111
|
+
## Extending the language
|
|
112
|
+
|
|
113
|
+
**_EasyCoder_** can be extended to add new functionality with the use of 'plugins'. These contain compiler and runtime modules for the added language features. **_EasyCoder_** can use the added keywords, values and conditions freely; the effect is completely seamless. There is an outline example in the `plugins` directory called `example.py`, which comprises a module called `Points` with new language syntax to deal with two-valued items such as coordinates. In the `scripts` directory there is `points.ecs`, which exercises the new functionality.
|
|
114
|
+
|
|
115
|
+
A plugin can act as a wrapper around any Python functionality that has a sensible API, thereby hiding its complexity. The only challenge is to devise an unambiguous syntax that doesn't clash with anything already existing in **_EasyCoder_**.
|
|
116
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
**_EasyCoder_** is a high-level English-like scripting language suited for prototyping and rapid testing of ideas. It operates on the command line and a graphics module is under construction. This version of the language is written in Python and it acts as a fairly thin wrapper around Python functions, giving fast compilation and good runtime performance for general applications.
|
|
3
|
+
<hr>
|
|
4
|
+
|
|
5
|
+
There is also a JavaScript version of **_EasyCoder_**, which provides a full set of graphical features to run in a browser. For this, please visit
|
|
6
|
+
|
|
7
|
+
Repository: [https://github.com/easycoder/easycoder.github.io](https://github.com/easycoder/easycoder.github.io)
|
|
8
|
+
Website: [https://easycoder.github.io](https://easycoder.github.io)
|
|
9
|
+
<hr>
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
Install **_EasyCoder_** in your Python environment:
|
|
13
|
+
```
|
|
14
|
+
pip install requests pytz easycoder
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Test the install by typing the command `easycoder`.
|
|
18
|
+
<hr>
|
|
19
|
+
On Linux, this will probably fail as the installer places the executable file in the `$HOME/.local/bin` directory. So give the command
|
|
20
|
+
```
|
|
21
|
+
export PATH=$HOME/.local/bin:$PATH
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
To make this change permanent, edit your `.profile` file, adding the following:
|
|
25
|
+
```
|
|
26
|
+
# set PATH so it includes user's private .local/bin if it exists
|
|
27
|
+
if [ -d "$HOME/.local/bin" ] ; then
|
|
28
|
+
PATH="$HOME/.local/bin:$PATH"
|
|
29
|
+
fi
|
|
30
|
+
```
|
|
31
|
+
<hr>
|
|
32
|
+
|
|
33
|
+
Now write a test script, 'hello.ecs', containing the following:
|
|
34
|
+
```
|
|
35
|
+
print `Hello, world!`
|
|
36
|
+
```
|
|
37
|
+
(Note the backticks.) This is traditionally the first program to be written in virtually any language. To run it, use `easycoder hello.ecs`.
|
|
38
|
+
|
|
39
|
+
The output will look like this (the version number will differ):
|
|
40
|
+
```
|
|
41
|
+
EasyCoder version 250101.1
|
|
42
|
+
Compiled <anon>: 1 lines (2 tokens) in 0 ms
|
|
43
|
+
Run <anon>
|
|
44
|
+
1-> Hello, world!
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
It's conventional to add a program title to a script:
|
|
48
|
+
```
|
|
49
|
+
! Test script
|
|
50
|
+
script Test
|
|
51
|
+
print `Hello, world!`
|
|
52
|
+
```
|
|
53
|
+
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
|
|
54
|
+
```
|
|
55
|
+
EasyCoder version 250101.1
|
|
56
|
+
Compiled Test: 3 lines (4 tokens) in 0 ms
|
|
57
|
+
Run Test
|
|
58
|
+
3-> Hello, world!
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
As you might guess from the above, the print command shows the line in the script it was called from. This is very useful in tracking down debugging print commands in large scripts.
|
|
62
|
+
|
|
63
|
+
Here in the repository is a folder called `scripts` containing some sample scripts:
|
|
64
|
+
|
|
65
|
+
`fizzbuzz.ecs` is a simple programming challenge often given at job interviews
|
|
66
|
+
`tests.ecs` is a test program containing many of the **_EasyCoder_** features
|
|
67
|
+
`benchmark.ecs` allows the performance of **_EasyCoder_** to be compared to other languages if a similar script is written for each one.
|
|
68
|
+
|
|
69
|
+
## Graphical programmming
|
|
70
|
+
**_EasyCoder_** includes a graphical programming environment that is in the early stages of development. Some demo scripts will be included in the `scripts` directory; these can be recognised by the extension`.ecg`. To run them, first install `tkinter`. On Linux this is done with
|
|
71
|
+
```
|
|
72
|
+
sudo apt install python3-tk
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Next, install the Python `pySimpleGUI` graphics library; this is done with `pip install pysimplegui`. Then run your **_EasyCoder_** script using `easycoder {scriptname}.ecg`.
|
|
76
|
+
|
|
77
|
+
Graphical scripts look much like any other script but their file names must use the extension `.ecg` to signal to **_EasyCoder_** that it needs to load the graphics module. Non-graphical applications can use any extension but `.ecs` is recommended. This allows the **_EasyCoder_** application to be used wherever Python is installed, in either a command-line or a graphical environment, but graphics will of course not be available in the former.
|
|
78
|
+
|
|
79
|
+
Some demo graphical scripts will included in the `scripts` directory as development proceeds.
|
|
80
|
+
|
|
81
|
+
`gtest.ecg` contains sample code to demonstrate and test basic features.
|
|
82
|
+
|
|
83
|
+
## Significant features
|
|
84
|
+
|
|
85
|
+
- English-like syntax based on vocabulary rather than structure. Scripts can be read as English
|
|
86
|
+
- Comprehensive feature set
|
|
87
|
+
- Runs directly from source scripts. A fast compiler creates efficient intermediate code that runs immediately after compilation
|
|
88
|
+
- Low memory requirements
|
|
89
|
+
- Minimim dependency on other 3rd-party packages
|
|
90
|
+
- Built-in co-operative multitasking
|
|
91
|
+
- Dynamic loading of scripts on demand
|
|
92
|
+
- The language can be extended seamlessly using plugin function modules
|
|
93
|
+
- Plays well with any Python code
|
|
94
|
+
- Fully Open Source
|
|
95
|
+
|
|
96
|
+
## Programming reference
|
|
97
|
+
|
|
98
|
+
**_EasyCoder_** comprises a set of modules to handle tokenisation, compilation and runtime control. Syntax and grammar are defined by [packages](doc/README.md), of which there are currently two; the [core](doc/core/README.md) package, which implements a comprehensive set of command-line programming features, and and the [graphics](doc/graphics/README.md) package, which adds graphical features in a windowing environment.
|
|
99
|
+
|
|
100
|
+
## Extending the language
|
|
101
|
+
|
|
102
|
+
**_EasyCoder_** can be extended to add new functionality with the use of 'plugins'. These contain compiler and runtime modules for the added language features. **_EasyCoder_** can use the added keywords, values and conditions freely; the effect is completely seamless. There is an outline example in the `plugins` directory called `example.py`, which comprises a module called `Points` with new language syntax to deal with two-valued items such as coordinates. In the `scripts` directory there is `points.ecs`, which exercises the new functionality.
|
|
103
|
+
|
|
104
|
+
A plugin can act as a wrapper around any Python functionality that has a sensible API, thereby hiding its complexity. The only challenge is to devise an unambiguous syntax that doesn't clash with anything already existing in **_EasyCoder_**.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# _EasyCoder_ packages
|
|
2
|
+
|
|
3
|
+
'Packages' are components of the **_EasyCoder_** system that deal with specific groups of language features. Those included or available from the repository are
|
|
4
|
+
|
|
5
|
+
[core](core/README.md) contains all the language features needed to construct command-line applications to run on any computer equipped with Python.
|
|
6
|
+
|
|
7
|
+
[graphics](graphics/README.md) contains a growing selection of graphical language features, to construct applications that will run on a computer with a graphical user interface; Windows, Mac or Linux.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# The 'core' package
|
|
2
|
+
|
|
3
|
+
The core package contains all the keywords values and conditionals needed for general programming, and to build most command-line tools these are all that will be needed.
|
|
4
|
+
|
|
5
|
+
There are three primary components to the language:
|
|
6
|
+
|
|
7
|
+
- Keywords
|
|
8
|
+
- Values
|
|
9
|
+
- Conditions
|
|
10
|
+
|
|
11
|
+
The core keywords are:
|
|
12
|
+
|
|
13
|
+
[add](keywords/add.md) [append](keywords/append.md) [assert](keywords/assert.md) [begin](keywords/begin.md) [clear](keywords/clear.md) [close](keywords/close.md) [create](keywords/create.md) [debug](keywords/debug.md) [decrement](keywords/decrement.md) [delete](keywords/delete.md) [divide](keywords/divide.md) [exit](keywords/exit.md) [file](keywords/file.md) [fork](keywords/fork.md) [get](keywords/get.md) [go](keywords/go.md) [gosub](keywords/gosub.md) [if](keywords/if.md) [import](keywords/import.md) [increment](keywords/increment.md) [index](keywords/index.md) [init](keywords/init.md) [input](keywords/input.md) [load](keywords/load.md) [lock](keywords/lock.md) [module](keywords/module.md) [multiply](keywords/multiply.md) [negate](keywords/negate.md) [open](keywords/open.md) [pop](keywords/pop.md) [post](keywords/post.md) [print](keywords/print.md) [push](keywords/push.md) [put](keywords/put.md) [read](keywords/read.md) [replace](keywords/replace.md) [return](keywords/return.md) [run](keywords/run.md) [save](keywords/save.md) [script](keywords/script.md) [set](keywords/set.md) [split](keywords/split.md) [stack](keywords/stack.md) [stop](keywords/stop.md) [system](keywords/system.md) [take](keywords/take.md) [toggle](keywords/toggle.md) [truncate](keywords/truncate.md) [unlock](keywords/unlock.md) [variable](keywords/variable.md) [wait](keywords/wait.md) [while](keywords/while.md) [write](keywords/write.md)
|
|
14
|
+
|
|
15
|
+
The core values are:
|
|
16
|
+
|
|
17
|
+
[arg](values/arg.md) [args](values/args.md) [cos](values/cos.md) [count](values/count.md) [datime/datetime](values/datime.md) [decode](values/decode.md) [element](values/element.md) [elements](values/elements.md) [empty](values/empty.md) [encode](values/encode.md) [error](values/error.md) [files](values/files.md) [float](values/float.md) [from](values/from.md) [hash](values/hash.md) [index](values/index.md) [integer](values/integer.md) [json](values/json.md) [keys](values/keys.md) [left](values/left.md) [length](values/length.md) [lowercase](values/lowercase.md) [mem/memory](values/mem.md) [modification](values/modification.md) [message](values/message.md) [newline](values/newline.md) [now](values/now.md) [position](values/position.md) [property](values/property.md) [random](values/random.md) [right](values/right.md) [sin](values/sin.md) [stringify](values/stringify.md) [tab](values/tab.md) [tan](values/tan.md) [timestamp](values/timestamp.md) [today](values/today.md) [trim](values/trim.md) [type](values/type.md) [uppercase](values/uppercase.md) [value](values/value.md) [weekday](values/weekday.md)
|
|
18
|
+
|
|
19
|
+
The core conditions are:
|
|
20
|
+
|
|
21
|
+
[boolean](conditions/boolean.md) [empty](conditions/empty.md) [ends](conditions/ends.md) [even](conditions/even.md) [exists](conditions/exists.md) [greater](conditions/greater.md) [has property](conditions/hasProperty.md) [includes](conditions/includes.md) [is](conditions/is.md) [less](conditions/less.md) [list](conditions/list.md) [numeric](conditions/numeric.md) [none](conditions/none.md) [not](conditions/not.md) [object](conditions/object.md) [odd](conditions/odd.md) [starts](conditions/starts.md) [string](conditions/string.md)
|
|
22
|
+
|
|
23
|
+
[Back](../README.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# boolean
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] boolean`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if MyVariable is boolean stop`
|
|
8
|
+
``if `true` is boolean stop` ``
|
|
9
|
+
|
|
10
|
+
## Description:
|
|
11
|
+
Tests if the given value is boolean. The inclusion of `[not]` negates the test.
|
|
12
|
+
|
|
13
|
+
Next: [empty](empty.md)
|
|
14
|
+
Prev: [string](string.md)
|
|
15
|
+
|
|
16
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# empty
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] empty`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if MyVariable is empty stop`
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the given value is an empty string. The inclusion of `[not]` negates the test.
|
|
11
|
+
|
|
12
|
+
Next: [ends](ends.md)
|
|
13
|
+
Prev: [boolean](boolean.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# ends
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} ends with {text}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
``if MyVariable ends with `#` stop` ``
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the given value ends with a given string.
|
|
11
|
+
|
|
12
|
+
Next: [even](even.md)
|
|
13
|
+
Prev: [empty](empty.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# even
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} ends with {text}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
``if MyVariable ends with `#` stop` ``
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the given number is even. The inclusion of `[not]` negates the test, or you can use [odd](odd.md).
|
|
11
|
+
|
|
12
|
+
Next: [exists](exists.md)
|
|
13
|
+
Prev: [ends](ends.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# greater
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] greater than {other value}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if 10 is greater than 5 stop`
|
|
8
|
+
`if Value is not greater than 100 stop`
|
|
9
|
+
|
|
10
|
+
## Description:
|
|
11
|
+
Tests if the value is greater than the second value. The inclusion of `[not]` negates the test.
|
|
12
|
+
|
|
13
|
+
Next: [has property](hasProperty.md)
|
|
14
|
+
Prev: [exists](exists.md)
|
|
15
|
+
|
|
16
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# has property
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} has property {property}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
``if Users has property `Andrew` stop` ``
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value - usually a variable - has the named property as one of its attributes.
|
|
11
|
+
|
|
12
|
+
Next: [includes](includes.md)
|
|
13
|
+
Prev: [greater](greater.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# includes
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} includes {element}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
``if Animals includes `cat` stop` ``
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the array - usually a variable - has the named element as one of its members.
|
|
11
|
+
|
|
12
|
+
Next: [is](is.md)
|
|
13
|
+
Prev: [has property](hasProperty.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# is
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is {second value}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
``if Animal is `cat` stop` ``
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value is identical to the second value.
|
|
11
|
+
|
|
12
|
+
Next: [less](less.md)
|
|
13
|
+
Prev: [includes](includes.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# less
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] less than {other value}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if 10 is less than 5 stop`
|
|
8
|
+
`if Value is not less than 100 stop`
|
|
9
|
+
|
|
10
|
+
## Description:
|
|
11
|
+
Tests if the value is less than the second value. The inclusion of `[not]` negates the test.
|
|
12
|
+
|
|
13
|
+
Next: [list](less.md)
|
|
14
|
+
Prev: [is](is.md)
|
|
15
|
+
|
|
16
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# list
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] list`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if MyData is not list stop`
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value is a list. The inclusion of `[not]` negates the test.
|
|
11
|
+
|
|
12
|
+
Next: [numeric](numeric.md)
|
|
13
|
+
Prev: [less](less.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# none
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] none`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if MyData is not none stop`
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value has the Python value `None`. The inclusion of `[not]` negates the test.
|
|
11
|
+
|
|
12
|
+
Next: [not](not.md)
|
|
13
|
+
Prev: [numeric](list.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# not
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is not {second value}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if Value is not 100 stop`
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value is not the same as the second value.
|
|
11
|
+
|
|
12
|
+
Next: [object](obect.md)
|
|
13
|
+
Prev: [none](none.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# numeric
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] numeric`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if MyData is not numeric stop`
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value is a numeric value. The inclusion of `[not]` negates the test.
|
|
11
|
+
|
|
12
|
+
Next: [none](none.md)
|
|
13
|
+
Prev: [list](list.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# object
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] object`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if Value is object stop`
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value is an object. The inclusion of `[not]` negates the test.
|
|
11
|
+
|
|
12
|
+
Next: [odd](odd.md)
|
|
13
|
+
Prev: [not](not.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# odd
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} is [not] odd`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
`if Value is odd stop`
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value is an odd number. The inclusion of `[not]` negates the test, or you can use [even](even.md).
|
|
11
|
+
|
|
12
|
+
Next: [starts](starts.md)
|
|
13
|
+
Prev: [object](object.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# starts
|
|
2
|
+
|
|
3
|
+
## Syntax:
|
|
4
|
+
`{value} starts with {text}`
|
|
5
|
+
|
|
6
|
+
## Examples:
|
|
7
|
+
``if Value starts with `!` stop` ``
|
|
8
|
+
|
|
9
|
+
## Description:
|
|
10
|
+
Tests if the value starts with the given text.
|
|
11
|
+
|
|
12
|
+
Next: [string](string.md)
|
|
13
|
+
Prev: [odd](odd.md)
|
|
14
|
+
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
## add
|
|
2
|
+
|
|
1
3
|
## Syntax:
|
|
2
4
|
`add {value} to {variable}`
|
|
3
5
|
`add {value} to {value} giving {variable}`
|
|
@@ -10,4 +12,4 @@ Adds a numeric value to a numeric variable or adds two values and puts the resul
|
|
|
10
12
|
Next: [append](append.md)
|
|
11
13
|
Prev: [write](write.md)
|
|
12
14
|
|
|
13
|
-
[Back](
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# append
|
|
2
|
+
|
|
1
3
|
## Syntax:
|
|
2
4
|
`append {value} to {array}`
|
|
3
5
|
## Examples:
|
|
@@ -10,4 +12,4 @@ Appends an item to a JSON array, which is is a string value held in a single var
|
|
|
10
12
|
Next: [assert](assert.md)
|
|
11
13
|
Prev: [add](add.md)
|
|
12
14
|
|
|
13
|
-
[Back](
|
|
15
|
+
[Back](../../README.md)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# close
|
|
2
|
+
|
|
1
3
|
## Syntax:
|
|
2
4
|
`close {file}`
|
|
3
5
|
## Examples:
|
|
@@ -8,4 +10,4 @@ Close the file identified by the `{file}` variable. See `file`, `open`, `read` a
|
|
|
8
10
|
Next: [create](create.md)
|
|
9
11
|
Prev: [clear](clear.md)
|
|
10
12
|
|
|
11
|
-
[Back](
|
|
13
|
+
[Back](../../README.md)
|