Skip to content

Commit 4519409

Browse files
committed
doc
1 parent 62611a2 commit 4519409

File tree

5 files changed

+47
-30
lines changed

5 files changed

+47
-30
lines changed

README.md

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,58 @@
11
# 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.
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.
33

4-
The JavaScript version of EasyCoder, which provides a full set of graphical features to run in a browser, is at [https://easycoder.github.io](https://easycoder.github.io)
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)
58

69
## Quick Start
7-
1: Install EasyCoder in your Python environment:
10+
Install **_EasyCoder_** in your Python environment:
811
```
912
pip install easycoder
1013
```
11-
2: Write a test script, 'hello.ecs':
14+
Write a test script, 'hello.ecs', containing the following:
1215
```
1316
print `Hello, world!`
1417
```
15-
This is traditionally the first program to be written in virtually any language. To run it, use the following command:
16-
```
17-
easycoder hello.ecs
18-
```
18+
This is traditionally the first program to be written in virtually any language. To run it, use `easycoder hello.ecs`.
19+
1920
The output will look like this:
21+
2022
```
23+
EasyCoder version 5
2124
Compiled <anon>: 1 lines (2 tokens) in 0 ms
2225
Run <anon>
2326
1-> Hello, world!
2427
```
25-
To avoid having to use REPL you can set up a simple executable command such as this Python script. On Linux the first line will ensure it runs as a command if given execute permission. You can name it 'easycoder' - there's no need for a '.py' extension.
26-
```
27-
#!/bin/python3
28-
29-
from sys import argv
30-
from easycoder import Program
31-
32-
if (len(argv) > 1):
33-
Program(argv[1:])
34-
else:
35-
print('Syntax: easycoder <scriptname> [plugins]')
36-
```
37-
With this you can run your script with the command `easycoder hello.ecs`. You can place `easycoder` anywhere on your system execution path, such as in a local `bin` directory.
38-
3928
It's conventional to add a program title to a script:
29+
4030
```
4131
! Test script
42-
4332
script Test
44-
4533
print `Hello, world!`
4634
```
4735
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+
4837
```
38+
EasyCoder version 5
4939
Compiled Test: 5 lines (4 tokens) in 0 ms
5040
Run Test
5141
5-> Hello, world!
5242
```
5343
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.
5444

55-
In the repository is a folder called `tests` containing a couple of sample scripts. `benchmark.ecs` allows the performance of EasyCoder to be compared to other languages if a similar program is written for each one. `tests.ecs` is a test program containing many of the EasyCoder features.
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
5650

5751
## The EasyCoder programming language
5852
There are three primary components to the language:
59-
1 Keywords
60-
2 Values
61-
3 Conditions
6253

63-
All program lines start with a keyword - a command to EasyCoder to do something
54+
- Keywords
55+
- Values
56+
- Conditions
6457

65-
(Under construction)
58+
[Keywords](doc/keywords.md)

doc/core/add.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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 Total 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, but if you assign a variable to hold the result of an addition it will lose whatever value it previously held.

doc/core/append.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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).

doc/keywords.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# EasyCoder Keywords
2+
3+
The core package contains all the keywords needed for general programming, and in most cases these all that will be needed.
4+
5+
The core keywords are:
6+
7+
[add](core/add.md) [append](core/append)

scripts/hello.ecs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print `Hello, world!`

0 commit comments

Comments
 (0)