easycoder 241211.3__py2.py3-none-any.whl → 250116.3__py2.py3-none-any.whl
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/README.md +6 -0
- easycoder/__init__.py +1 -1
- easycoder/ec_classes.py +3 -0
- easycoder/ec_compiler.py +11 -7
- easycoder/ec_core.py +493 -208
- easycoder/ec_graphics.py +274 -0
- easycoder/ec_gutils.py +52 -0
- easycoder/ec_handler.py +1 -0
- easycoder/ec_program.py +156 -79
- easycoder/ec_value.py +21 -14
- easycoder-250116.3.dist-info/METADATA +116 -0
- easycoder-250116.3.dist-info/RECORD +17 -0
- {easycoder-241211.3.dist-info → easycoder-250116.3.dist-info}/WHEEL +1 -1
- easycoder-241211.3.dist-info/METADATA +0 -72
- easycoder-241211.3.dist-info/RECORD +0 -14
- {easycoder-241211.3.dist-info → easycoder-250116.3.dist-info}/LICENSE +0 -0
- {easycoder-241211.3.dist-info → easycoder-250116.3.dist-info}/entry_points.txt +0 -0
easycoder/ec_value.py
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
from .ec_classes import FatalError
|
|
2
2
|
|
|
3
|
+
# Create a constant
|
|
4
|
+
def getConstant(str):
|
|
5
|
+
value = {}
|
|
6
|
+
value['type'] = 'text'
|
|
7
|
+
value['content'] = str
|
|
8
|
+
return value
|
|
9
|
+
|
|
3
10
|
class Value:
|
|
4
11
|
|
|
5
12
|
def __init__(self, compiler):
|
|
@@ -15,7 +22,7 @@ class Value:
|
|
|
15
22
|
return None
|
|
16
23
|
|
|
17
24
|
value = {}
|
|
18
|
-
|
|
25
|
+
|
|
19
26
|
if token == 'true':
|
|
20
27
|
value['type'] = 'boolean'
|
|
21
28
|
value['content'] = True
|
|
@@ -51,14 +58,14 @@ class Value:
|
|
|
51
58
|
if item != None:
|
|
52
59
|
return item
|
|
53
60
|
self.compiler.rewindTo(mark)
|
|
54
|
-
|
|
61
|
+
# self.compiler.warning(f'I don\'t understand \'{token}\'')
|
|
55
62
|
return None
|
|
56
63
|
|
|
57
64
|
def compileValue(self):
|
|
58
65
|
token = self.getToken()
|
|
59
66
|
item = self.getItem()
|
|
60
67
|
if item == None:
|
|
61
|
-
|
|
68
|
+
self.compiler.warning(f'ec_value.compileValue: Cannot get the value of "{token}"')
|
|
62
69
|
return None
|
|
63
70
|
|
|
64
71
|
value = {}
|
|
@@ -80,19 +87,19 @@ class Value:
|
|
|
80
87
|
value = domain.modifyValue(value)
|
|
81
88
|
|
|
82
89
|
return value
|
|
83
|
-
|
|
90
|
+
|
|
84
91
|
def compileConstant(self, token):
|
|
85
92
|
value = {}
|
|
86
|
-
if token
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
if type(token) == 'str':
|
|
94
|
+
token = eval(token)
|
|
95
|
+
if isinstance(token, int):
|
|
96
|
+
value['type'] = 'int'
|
|
97
|
+
value['content'] = token
|
|
98
|
+
return value
|
|
99
|
+
if isinstance(token, float):
|
|
100
|
+
value['type'] = 'float'
|
|
101
|
+
value['content'] = token
|
|
102
|
+
return value
|
|
96
103
|
value['type'] = 'text'
|
|
97
104
|
value['content'] = token
|
|
98
105
|
return value
|
|
@@ -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,17 @@
|
|
|
1
|
+
easycoder/README.md,sha256=PYqOc_SkIGiFbyCNs90y7JqoqWe4aO1xYIW-6bOnFKU,573
|
|
2
|
+
easycoder/__init__.py,sha256=cxPTgZu3SQ4VrP87zrYqBbSfyYN9eFpLgxLd57elEQA,262
|
|
3
|
+
easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
|
|
4
|
+
easycoder/ec_compiler.py,sha256=dFJEA_uOhD-HeSiAdBzmmA6q3LHThUVoJpSETanmSHs,4800
|
|
5
|
+
easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
|
|
6
|
+
easycoder/ec_core.py,sha256=yO7d5OyEFHBDGKSaC1Fhf1uGjzsttAl6VCvR1W5X5YE,86279
|
|
7
|
+
easycoder/ec_graphics.py,sha256=zM0MDL0ES6WkcU0XizI6VTWp7NcJODMy1fIn7Rj2U4M,9469
|
|
8
|
+
easycoder/ec_gutils.py,sha256=fqh0VKfm2ry5yjHoOE1ufF7uu741lOU7EEwTUEabJ4k,1624
|
|
9
|
+
easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
|
|
10
|
+
easycoder/ec_program.py,sha256=wU-vWRWAYK2Ie4EFnp8HeSPUL0bxz-j9HLQSNplObcc,9919
|
|
11
|
+
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
12
|
+
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
13
|
+
easycoder-250116.3.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
14
|
+
easycoder-250116.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
15
|
+
easycoder-250116.3.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
|
16
|
+
easycoder-250116.3.dist-info/METADATA,sha256=f2ymQEg79v-tk57RqjgFFiMeWABBcGRLKv2OTR6iXPE,6162
|
|
17
|
+
easycoder-250116.3.dist-info/RECORD,,
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: easycoder
|
|
3
|
-
Version: 241211.3
|
|
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
|
-
## EasyCoder programming reference
|
|
62
|
-
|
|
63
|
-
The language comprises a general-purpose core package, which can be enhanced by plugins to provide special features on demand.
|
|
64
|
-
|
|
65
|
-
[The core package](doc/README.md)
|
|
66
|
-
|
|
67
|
-
## Extending the language
|
|
68
|
-
|
|
69
|
-
**_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.
|
|
70
|
-
|
|
71
|
-
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_**
|
|
72
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
easycoder/__init__.py,sha256=vys8r-4skG-XdH6b0L8eS4WpTpCkVdV_-RaKL1snTMA,262
|
|
2
|
-
easycoder/ec_classes.py,sha256=mRvIk2d-yc20u54oX8fauKeYy-z_g30Otbl-dn5O6T4,1486
|
|
3
|
-
easycoder/ec_compiler.py,sha256=1z5U92uzUdCOO5-k0VXLnU581iAhwzQga04kfdTlpMY,4629
|
|
4
|
-
easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
|
|
5
|
-
easycoder/ec_core.py,sha256=j4YPwERad7iKSaUpbcFG6d5dlyLETK3M-np132G6d9s,76188
|
|
6
|
-
easycoder/ec_handler.py,sha256=WDDIz0awD3vSQZ149rgbUWsClt6zXqED8ByXQJ5p1Ds,2200
|
|
7
|
-
easycoder/ec_program.py,sha256=U5QRxcyYycTugyu1ew8prk6NUEqnvcGuFJSY9stN8vY,7870
|
|
8
|
-
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
9
|
-
easycoder/ec_value.py,sha256=aOvSF6bM1iKpcLLm0zyGerxHixBkyjE3iYl1Bx6jmzU,2381
|
|
10
|
-
easycoder-241211.3.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
11
|
-
easycoder-241211.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
12
|
-
easycoder-241211.3.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
13
|
-
easycoder-241211.3.dist-info/METADATA,sha256=kk6Hmmny8KtnC3gQhlpZEHYHV5zAU-8dGZc_KPKsRbM,3242
|
|
14
|
-
easycoder-241211.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|