easycoder 241211.2__tar.gz → 241215.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-241215.1/PKG-INFO +78 -0
- easycoder-241211.2/PKG-INFO → easycoder-241215.1/README.md +12 -17
- easycoder-241215.1/doc/README.md +20 -0
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/add.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/append.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/assert.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/begin.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/clear.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/close.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/create.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/debug.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/decrement.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/delete.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/divide.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/exit.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/file.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/fork.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/get.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/go.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/gosub.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/if.md +2 -2
- easycoder-241215.1/doc/core/import.md +13 -0
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/increment.md +2 -2
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/index.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/init.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/input.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/multiply.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/open.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/pop.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/post.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/print.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/push.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/put.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/read.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/replace.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/return.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/script.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/set.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/split.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/stack.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/stop.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/system.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/take.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/toggle.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/truncate.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/variable.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/wait.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/while.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/doc/core/write.md +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/__init__.py +2 -1
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/ec_classes.py +5 -2
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/ec_compiler.py +1 -1
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/ec_core.py +16 -14
- easycoder-241215.1/easycoder/ec_graphics.py +376 -0
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/ec_program.py +15 -7
- easycoder-241215.1/easycoder/ec_renderer.py +330 -0
- easycoder-241215.1/plugins/example.py +91 -0
- {easycoder-241211.2 → easycoder-241215.1}/pyproject.toml +4 -2
- easycoder-241215.1/scripts/graphics-demo.ecs +70 -0
- easycoder-241215.1/scripts/graphics-demo.json +36 -0
- easycoder-241215.1/scripts/points.ecs +16 -0
- easycoder-241211.2/README.md +0 -60
- easycoder-241211.2/doc/core.md +0 -12
- easycoder-241211.2/test.ecs +0 -10
- {easycoder-241211.2 → easycoder-241215.1}/LICENSE +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/ec_condition.py +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/ec_handler.py +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/ec_timestamp.py +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/easycoder/ec_value.py +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/plugins/ec_p100.py +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/scripts/benchmark.ecs +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/scripts/fizzbuzz.ecs +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/scripts/hello.ecs +0 -0
- {easycoder-241211.2 → easycoder-241215.1}/scripts/tests.ecs +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: easycoder
|
|
3
|
+
Version: 241215.1
|
|
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
|
+
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.
|
|
14
|
+
|
|
15
|
+
The JavaScript version of **_EasyCoder_**, which provides a full set of graphical features to run in a browser, is at
|
|
16
|
+
|
|
17
|
+
Repository: [https://github.com/easycoder/easycoder.github.io](https://github.com/easycoder/easycoder.github.io)
|
|
18
|
+
Website: [https://easycoder.github.io](https://easycoder.github.io)
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
Install **_EasyCoder_** in your Python environment:
|
|
22
|
+
```
|
|
23
|
+
pip install easycoder
|
|
24
|
+
```
|
|
25
|
+
Write a test script, 'hello.ecs', containing the following:
|
|
26
|
+
```
|
|
27
|
+
print `Hello, world!`
|
|
28
|
+
```
|
|
29
|
+
This is traditionally the first program to be written in virtually any language. To run it, use `easycoder hello.ecs`.
|
|
30
|
+
|
|
31
|
+
The output will look like this:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
EasyCoder version 5
|
|
35
|
+
Compiled <anon>: 1 lines (2 tokens) in 0 ms
|
|
36
|
+
Run <anon>
|
|
37
|
+
1-> Hello, world!
|
|
38
|
+
```
|
|
39
|
+
It's conventional to add a program title to a script:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
! Test script
|
|
43
|
+
script Test
|
|
44
|
+
print `Hello, world!`
|
|
45
|
+
```
|
|
46
|
+
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
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
EasyCoder version 5
|
|
50
|
+
Compiled Test: 5 lines (4 tokens) in 0 ms
|
|
51
|
+
Run Test
|
|
52
|
+
5-> Hello, world!
|
|
53
|
+
```
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
Here in the repository is a folder called `scripts` containing some sample scripts:
|
|
57
|
+
|
|
58
|
+
`benchmark.ecs` allows the performance of EasyCoder to be compared to other languages if a similar program is written for each one
|
|
59
|
+
`tests.ecs` is a test program containing many of the EasyCoder features
|
|
60
|
+
`fizzbuzz.ecs` is a simple programming challenge often given at job interviews
|
|
61
|
+
|
|
62
|
+
## Graphical programmming
|
|
63
|
+
**_EasyCoder_** is currently being extended to include a graphical programming environment. A single demo script `graphics-demo.ecs` is included in the `scripts` directory. To run it, first install the Python graphics library if it's not already present on your system. On Linux this is done with `sudo apt install python3-tk`. On Windows it's `pip install tk`. Then give the command `easycoder -g scripts/graphics-demo.ecs`.
|
|
64
|
+
|
|
65
|
+
As development progresses this demo script will be extended to include new features as they are added. **_EasyCoder_** graphics are handled by a library module, `ec_renderer` that can be used outside of the **EasyCoder_** environment, in other Python programs.
|
|
66
|
+
|
|
67
|
+
## EasyCoder programming reference
|
|
68
|
+
|
|
69
|
+
The language comprises a general-purpose core package, which can be enhanced by plugins to provide special features on demand.
|
|
70
|
+
|
|
71
|
+
[The core package](doc/README.md)
|
|
72
|
+
|
|
73
|
+
## Extending the language
|
|
74
|
+
|
|
75
|
+
**_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.
|
|
76
|
+
|
|
77
|
+
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_**
|
|
78
|
+
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: easycoder
|
|
3
|
-
Version: 241211.2
|
|
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
1
|
# Introduction
|
|
12
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.
|
|
13
3
|
|
|
14
4
|
The JavaScript version of **_EasyCoder_**, which provides a full set of graphical features to run in a browser, is at
|
|
15
5
|
|
|
16
|
-
Repository: [https://github.com/easycoder/easycoder.github.io](https://github.com/easycoder/easycoder.github.io)
|
|
6
|
+
Repository: [https://github.com/easycoder/easycoder.github.io](https://github.com/easycoder/easycoder.github.io)
|
|
17
7
|
Website: [https://easycoder.github.io](https://easycoder.github.io)
|
|
18
8
|
|
|
19
9
|
## Quick Start
|
|
@@ -58,14 +48,19 @@ Here in the repository is a folder called `scripts` containing some sample scrip
|
|
|
58
48
|
`tests.ecs` is a test program containing many of the EasyCoder features
|
|
59
49
|
`fizzbuzz.ecs` is a simple programming challenge often given at job interviews
|
|
60
50
|
|
|
61
|
-
##
|
|
62
|
-
|
|
51
|
+
## Graphical programmming
|
|
52
|
+
**_EasyCoder_** is currently being extended to include a graphical programming environment. A single demo script `graphics-demo.ecs` is included in the `scripts` directory. To run it, first install the Python graphics library if it's not already present on your system. On Linux this is done with `sudo apt install python3-tk`. On Windows it's `pip install tk`. Then give the command `easycoder -g scripts/graphics-demo.ecs`.
|
|
53
|
+
|
|
54
|
+
As development progresses this demo script will be extended to include new features as they are added. **_EasyCoder_** graphics are handled by a library module, `ec_renderer` that can be used outside of the **EasyCoder_** environment, in other Python programs.
|
|
63
55
|
|
|
64
|
-
|
|
65
|
-
- Values
|
|
66
|
-
- Conditions
|
|
56
|
+
## EasyCoder programming reference
|
|
67
57
|
|
|
68
58
|
The language comprises a general-purpose core package, which can be enhanced by plugins to provide special features on demand.
|
|
69
59
|
|
|
70
|
-
[The core package](doc/
|
|
60
|
+
[The core package](doc/README.md)
|
|
61
|
+
|
|
62
|
+
## Extending the language
|
|
63
|
+
|
|
64
|
+
**_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.
|
|
71
65
|
|
|
66
|
+
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,20 @@
|
|
|
1
|
+
# The 'core' package
|
|
2
|
+
|
|
3
|
+
There are three primary components to the language:
|
|
4
|
+
|
|
5
|
+
- Keywords
|
|
6
|
+
- Values
|
|
7
|
+
- Conditions
|
|
8
|
+
|
|
9
|
+
The core package contains all the keywords values and conditionals needed for general programming, and in most cases these are all that will be needed.
|
|
10
|
+
|
|
11
|
+
The core keywords are:
|
|
12
|
+
|
|
13
|
+
[add](core/add.md) [append](core/append.md) [assert](core/assert.md) [begin](core/begin.md) [clear](core/clear.md) [close](core/close.md) [create](core/create.md) [debug](core/debug.md) [decrement](core/decrement.md) [delete](core/delete.md) [divide](core/divide.md) [exit](core/exit.md) [file](core/file.md) [fork](core/fork.md) [get](core/get.md) [go](core/go.md) [gosub](core/gosub.md) [if](core/if.md) [import](core/import.md) [increment](core/increment.md) [index](core/index.md) [init](core/init.md) [input](core/input.md) [multiply](core/multiply.md) [open](core/open.md) [pop](core/pop.md) [post](core/post.md) [print](core/print.md) [push](core/push.md) [put](core/put.md) [read](core/read.md) [replace](core/replace.md) [return](core/return.md) [script](core/script.md) [set](core/set.md) [split](core/split.md) [stack](core/stack.md) [stop](core/stop.md) [system](core/system.md) [take](core/take.md) [toggle](core/toggle.md) [truncate](core/truncate.md) [variable](core/variable.md) [wait](core/wait.md) [while](core/while.md) [write](core/write.md)
|
|
14
|
+
|
|
15
|
+
The core values are:
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
The core conditions are:
|
|
19
|
+
|
|
20
|
+
[Back](../README.md)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
## Description:
|
|
9
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
10
|
|
|
11
|
-
Next: [
|
|
11
|
+
Next: [import](import.md)
|
|
12
12
|
Prev: [gosub](gosub.md)
|
|
13
13
|
|
|
14
|
-
[Back](../
|
|
14
|
+
[Back](../README.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Syntax:
|
|
2
|
+
`import {classname} from {path}`
|
|
3
|
+
|
|
4
|
+
## Examples:
|
|
5
|
+
`import Points from plugins/example.py`
|
|
6
|
+
|
|
7
|
+
## Description:
|
|
8
|
+
As with [script](script.md), `import` is a compiler directive that should be placed at the top of the script, under the [script](script.md) directive. It's used to call in a plugin language extension where needed. The example above is provided in the repository, to be used as a starting point for your own extra functionality.
|
|
9
|
+
|
|
10
|
+
Next: [increment](increment.md)
|
|
11
|
+
Prev: [if](if.md)
|
|
12
|
+
|
|
13
|
+
[Back](../README.md)
|
|
@@ -9,11 +9,14 @@ class FatalError:
|
|
|
9
9
|
sys.exit()
|
|
10
10
|
|
|
11
11
|
class AssertionError:
|
|
12
|
-
def __init__(self, program):
|
|
12
|
+
def __init__(self, program, msg=None):
|
|
13
13
|
code = program.code[program.pc]
|
|
14
14
|
lino = code['lino']
|
|
15
15
|
script = program.script.lines[lino].strip()
|
|
16
|
-
|
|
16
|
+
message = f'Assertion Error in {program.name} at line {lino + 1}'
|
|
17
|
+
if msg != None:
|
|
18
|
+
message += f': {msg}'
|
|
19
|
+
print(message)
|
|
17
20
|
sys.exit()
|
|
18
21
|
|
|
19
22
|
class RuntimeError:
|
|
@@ -101,7 +101,7 @@ class Compiler:
|
|
|
101
101
|
|
|
102
102
|
def showWarnings(self):
|
|
103
103
|
for warning in self.warnings:
|
|
104
|
-
print(f'Line {self.getLino() + 1}: {warning}')
|
|
104
|
+
print(f'Warning: Line {self.getLino() + 1}: {warning}')
|
|
105
105
|
|
|
106
106
|
def getSymbolRecord(self):
|
|
107
107
|
token = self.getToken()
|