Giter Site home page Giter Site logo

pannous / english-script Goto Github PK

View Code? Open in Web Editor NEW
162.0 16.0 19.0 28.2 MB

πŸ–Š οΌ₯ο½Žο½‡ο½Œο½‰ο½“ο½ˆ as a programming language

Ruby 86.78% Shell 0.23% LLVM 0.06% E 0.03% C# 0.06% Java 0.04% JavaScript 0.08% C 1.45% Brainfuck 11.27%
programming-language ruby compiler

english-script's Introduction

ENGLISH SCRIPT

This is English 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.

The guiding philosophy is to have forgiving interfaces yet strict implementations, and to make sigil special chars (!@#$%^&*[}...) completely optional.

UPDATE: There now is a python implementation of English Script called angle, compiling to bytecode.
Soon: Compilation to WebAssembly … and Ruby 2.3 gets bytecode as well!

πŸ““ Examples

Here are some of our favorite examples from the tests, working today:

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

πŸ–₯ INSTALL

git clone --recursive [email protected]:pannous/english-script.git

cd english-script

./install.sh

🐁 EXPERIMENT

Warning: The project is still in alpha, don't expect all tests to pass!

experiment by typing

./bin/angle "6 plus six"

./bin/angle samples/factorial.e or

Start the shell : ./bin/angle or rake shell

β¦  6 plus six

β¦  beep three times

β¦  x is 2; if all 0,2,4 are smaller 5 then increase x

Check out the samples and tests!

Test

Run the tests : rake test

Run an angle file: rake run[examples/test.e]

⏳ 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")}.map{|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 an email
  move that email to the trash folder
End

Here 'mail' acts as argument name and argument type at once. No more Java style Mail mail=new Mail().getMail();

πŸ“‘ Language Specification

Angle is a multi-paradigm programming language with gradual typing.

Read the DOSSIER for a more complete language specification, vision and some background.

The grammar is not meant to be linguistically complete, but functionality complete and easily extendable. It is currently running in the

Having a self-hosted "bootstrapped" compiler is an important mid-term goal.

"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 is a mistake.

To check out the current capabilities of English Script have a look at the tests, keywords and grammar

πŸ“°UPDATE: Since we love to compile our language to native or at least bytecode, we focussed on the python implementation of English script. Fortunately finally Ruby now supports bytecode as well, since version 2.3.0!

πŸ‘· Todos

  • Use the abstract syntax tree to compile instead of interpret (export via XML and Lisp s-expressions)
  • Better (real) function argument matching: Integrate the sine curve in the interval 1 to 10 with step size .1
  • Implement event system: Beep three times whenever the disc space is over 80%
  • Hook into more existing libraries (java,ifttt,rubyosa?,...)
  • IntelliJ plugin
  • Promote

This language might soon be used in our successful beloved Jeannie assistant, which has over 5 million downloads so far: http://www.voice-actions.com

For a background story/vision/philosophy/future of this project read the DOSSIER πŸ‘ΎπŸΊ

english-script's People

Contributors

kosiakk avatar pannous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

english-script's Issues

Installing english-script on Windows

I attempted to install EnglishScript using git clone --recursive [email protected]:pannous/english-script.git, but it produced the following error message on Windows:

Cloning into 'english-script'...
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to t
he list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Which steps will I need to follow in order to clone the english-script repository?

Syntactic ambiguity may need to be resolved

In this sample code, I noticed that function parameters were not clearly distinguished from other parts of functions, causing some confusion:

To check if person is online on Skype:
    Skype.checkStatus(person) //Is 'Skype' a parameter of this function?
    if result is "online": return yes
    else return no
End

This code would be easier to read if the parameters were explicitly specified, like this:

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

This describes the program's intention much more clearly, ensuring that no parameters are created accidentally.

Issue while launching just after building from source with ruby

In ubuntu 18.04, just after building english-script from the source with ruby tools, if we launch the "angle" executable, I faced the following issue

~/english-script$ ./bin/angle
Traceback (most recent call last):
3: from /home/cppxaxa/english-script/src/core/repl-shell.rb:1:in <main>' 2: from /home/cppxaxa/english-script/src/core/repl-shell.rb:1:in require_relative'
1: from /home/cppxaxa/english-script/src/core/english-parser.rb:7:in <top (required)>' /home/cppxaxa/english-script/src/core/english-parser.rb:7:in require_relative': cannot load such file -- /home/cppxaxa/english-script/src/core/interpretation (LoadError)

GRAMMAR

You forgot the Oxford comma in [1, 2, and 3]. (There could be others, but I'm too lazy to check)

EnglishScript should be translated into the Ο€ programming language

Today, I found a programming language called Ο€ that has implemented many of the features of EnglishScript. Ο€ has an extensible syntax, so it should be very easy to convert EnglishScript source code into Ο€ source code and vice-versa.

From Ο€'s official website is an example of a pattern that can be defined. This is very similar to EnglishScript's pattern definition syntax:

declare_pattern
   integer_potentiation ≔
   integer:i %W- "^" %W- integer:j
   β‡’ integer ➞
   {
      int result = i;
      for (int k = 1; k <= j-1; k++)
         result *= i;
      return result;
   };

The name of this pattern is integer_potentiation, the type of the pattern is integer, and the parameters are integer:i and integer:j.
This link shows another example of Ο€'s extensible syntax, which makes it an ideal target language for EnglishScript.

Requires COBOL integration

This is an ambitious project, but it will take a long time before it reaches the necessary critical mass to take over the world.

You could close a number of immediate gaps by provide integration with existing COBOL libraries. COBOL is the original "programming in english" language and is still actively in use.

Inform 7

Both of these languages could provide interesting inspiration for the language. For Inform 7, it is a english-like domain-specific language the syntax of grammar of which could be useful for this own language. The Inform 7 Recipe Book has many examples of the language.

Random note: the Smalltalk syntax for message sending/method invocation seems that it might fit in well. Example: Transcript show: 'Hello World!'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.