Skip to main content
![ENGLISH SCRIPT](English script.png "ENGLISH SCRIPT")

**[Angle](https://github.com/pannous/angle/)** is the Python implementation of [English](https://github.com/pannous/english-script) as a programming language.
The main purpose of this language is to make programming accessible to many more people, more fun and to facilitate programming computers via voice.

INSTALL
-------

`pip install angle`
<!-- `pip install anglang` -->

OR from source:

`git clone --recursive git@github.com:pannous/angle.git`

`cd angle`

`./install.sh`

Start the shell : `./bin/angle`

Examples
--------
Here are some of our favorite working examples from the [tests](tests):

`assert two minus 1½ equals 0.5`

`beep three times`
(There will be a generation of programmers who will shake their heads that there ever was a programming language which did not interpret that sentence correctly.)

`assert square of [1,2 and 3] equals 1,4,9`

`assert 3rd word in 'hi my friend' is 'friend'`

`x is 2; if all 0,2,4 are smaller 5 then increase x; assert x equals 3 `

`beep every three seconds`

`last item in 'hi','you' is equal to 'you'`


```
While Peter is online on Skype
make a beep
sleep for 10 seconds
Done
```

```
To check if person is online on Skype:
Skype.checkStatus(person)
if result is "online": return yes
else return no
End
```

Status:
-----------

ALPHA, partly usable, some [tests](tests) not yet passing:
[![Build Status](https://travis-ci.org/pannous/angle.png)](https://travis-ci.org/pannous/angle)

In progress
-----------

`add one to every odd number in 1,2,3 == 2,2,4`

The implicit list filter '**that**' applies a selection criterion to all elements.

`delete all files in my home folder that end with 'bak'`

translates to ruby:

`folder(:home).files.select{|that|that.end_with?("bak")}.each{|file| file.delete}`


Implicit lambda variable '**it**'

`for all mails by peter: mark it as read if its subject contains 'SPAM'`

translates to ruby:

`mails(by: Peter).each{|it| it.mark(:read) if it.subject.match('SPAM')}`


The last example also illustrates what we call **matching by type name**.
```
To delete mail:
move that mail to trash folder
End
```
Here 'mail' acts as argument name and argument type at once.
No more Java style Mail mail=new Mail().getMail();


<!-- Self documenting code is not about the "how", it's about the "what". Ex: A method name should be FilterOutOddNumbers(). Not MapModulo2Predicate(). -->

EXPERIMENT
----------
Run it and see yourself!

**experiment** by typing

`./bin/angle "6 plus six"`

`./bin/angle examples/test.e`

`./bin/angle` (no args to start the shell)

`⦠ 1/4`

`⦠ 6 plus six`

`⦠ beep three times`

`⦠ x is 2; if all 0,2,4 are smaller 5 then increase x`



Language Specification
----------------------
Angle is a multi-paradigm programming language with [gradual typing](https://en.m.wikipedia.org/wiki/Gradual_typing).

Read the [DOSSIER](https://github.com/pannous/english-script/blob/master/DOSSIER.md) for a more complete [**language specification**](https://github.com/pannous/english-script/blob/master/DOSSIER.md), vision and some background.

The grammar is not meant to be linguistically complete, but [functionality complete](https://en.wikipedia.org/wiki/Functional_completeness) and easily extendable.
"Premature optimization is the root of all evil." Many programming languages 'optimize' on the syntax level in order to optimize the resulting applications. Maybe [this](http://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD667.html) is a mistake.

To check out the current capabilities of English Script have a look at the [tests](https://github.com/pannous/angle/tree/master/tests),
[keywords](https://github.com/pannous/angle/blob/master/core/english_tokens.py) and
[grammar](https://github.com/pannous/angle/blob/master/core/english_parser.py)

Future
------
English Script / Angle is currently running in the
* [ruby](https://github.com/pannous/english-script) and [python](https://github.com/pannous/angle) environment, but will soon compile to the
* WEB(!!) thanks to [WebAssembly](https://github.com/WebAssembly/design)
* JVM thanks to [Mirah](https://github.com/mirah/mirah), [zippy](https://bitbucket.org/ssllab/zippy/overview) and [truffle](https://github.com/OracleLabs/Truffle)
* [.Net/CLR/DLR](https://en.wikipedia.org/wiki/Dynamic_Language_Runtime) (via [Cecil](https://github.com/jbevain/cecil), maybe Mirah too),
* As a final aim: run **natively**, maybe similar to [Crystal](https://github.com/manastech/crystal), [Vala](https://en.wikipedia.org/wiki/Vala_%28programming_language%29) or RPython

Having a [self-hosted "bootstrapped" compiler](https://en.wikipedia.org/wiki/Bootstrapping_%28compilers%29) is an important mid-term goal.

**precedence**
One very hot idea is to allow modifying the language grammar on the fly, at least till a limited extend.
One first step would be to make possible setting the precedence of functions.
This would enable very natural and sweet mathematical expressions, especially combined with Unicode names:
```
class Complex alias ℂ (re, im)
to add number x
ℂ(this.real+x.real, this.im+x.im)
end
alias '+' = add
end
ℂ.add.precedence=Number.add.precedence-1
ī := √-1
ī + 3ī == 4ī
```
This would run against the goal to avoid sigil special chars though.



Why the new python implementation
------------------------------------
We can **compile** English script / [Angle](https://github.com/pannous/angle/) directly to python byte-code:
As opposed to Ruby, Python(3) comes with a very nice and clean abstract syntax tree as well as byte code capabilities preinstalled.
Compiling is so much nicer & faster than interpreted code.
Also the Python execution model is a bit more friendly than the Ruby VM, but both have their [advantages and drawbacks](https://github.com/pannous/cast/blob/master/ruby-vs-python.txt). The biggest advantage of Python is that objects can be given attributes at any time o.x='y'! However pythons limited lamda capabilities are a painful limitation.


"There should be one-- and preferably only one --obvious way to do it"
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.

For a background story/vision/philosophy/future of this project read the [DOSSIER](https://github.com/pannous/english-script/tree/master/DOSSIER.md)

Release files for angle 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for angle 0.1.9
File Size Uploaded
angle-0.1.9.tar.gz 137.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for angle 0.1.9
File Interpreter ABI Platform
angle-0.1.9-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 306.6 kB

Release files / angle-0.1.9.tar.gz

Download URL angle-0.1.9.tar.gz
Size 137.7 kB
Tags Source
SHA-256 checksum
How to use checksums
158b8d01f13fcba5e34306dd77ca3901ed914d03bc35243e1296daa7a8a591c4
BLAKE2b-256 checksum
How to use checksums
0a26fb65280fc05942a4c63c59f6b1d87b7c89342c3f9c05c7a2690ff3cd8dfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / angle-0.1.9-py2.py3-none-any.whl

Download URL angle-0.1.9-py2.py3-none-any.whl
Size 168.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9d6b09703bf191afe2598cc33016e9c732d688d5303ff61770f3d210c0eb3cdc
BLAKE2b-256 checksum
How to use checksums
2e35a81e35dbaeca8bd7e39b531ac2a0df56898033b086f996699ad62ab6d582
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page