Skip to content

Commit 4999961

Browse files
committed
v241112.3
1 parent a4c8579 commit 4999961

File tree

7 files changed

+13
-5
lines changed

7 files changed

+13
-5
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,9 @@ Here in the repository is a folder called `scripts` containing some sample scrip
5353
The language comprises a general-purpose core package, which can be enhanced by plugins to provide special features on demand.
5454

5555
[The core package](doc/README.md)
56+
57+
## Extending the language
58+
59+
**_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.
60+
61+
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_**

dist/easycoder-241211.2.tar.gz

-33.2 KB
Binary file not shown.

dist/easycoder-241211.3.tar.gz

33.9 KB
Binary file not shown.

easycoder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
from .ec_timestamp import *
1010
from .ec_value import *
1111

12-
__version__ = "241211.2"
12+
__version__ = "241211.3"

easycoder/ec_classes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ def __init__(self, compiler, message):
99
sys.exit()
1010

1111
class AssertionError:
12-
def __init__(self, program):
12+
def __init__(self, program, msg=None):
1313
code = program.code[program.pc]
1414
lino = code['lino']
1515
script = program.script.lines[lino].strip()
16-
print(f'Assertion Error in {program.name} at line {lino + 1}')
16+
message = f'Assertion Error in {program.name} at line {lino + 1}'
17+
if msg != None:
18+
message += f': {msg}'
19+
print(message)
1720
sys.exit()
1821

1922
class RuntimeError:

scripts/points.ecs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
point Point2
99
variable Distance
1010

11-
print `Hello, world!`
12-
1311
set Point1 to 50 500
1412
set Point2 to 200 300
1513

1614
put the distance between Point1 and Point2 into Distance
15+
assert Distance is 250 with `Distance is ` cat Distance cat `: should be 250`
1716
print `The distance is ` cat Distance cat ` units`

0 commit comments

Comments
 (0)