Ezhil-Language-Foundation / Ezhil-Lang

எழில் - ஒரு தமிழ் நிரலாக்க மொழி; தமிழ் மாணவர்களுக்கு இது முதல்முறை கணிப்பொறி நிரல் ஏழுத உதவும் (Ezhil, is a fun Tamil programming language for K-12).
http://ezhillang.org/
GNU General Public License v3.0
169 stars 46 forks source link

Add console entry point for `ezhili` #146

Closed kracekumar closed 8 years ago

kracekumar commented 8 years ago

./ezhili fname was used for executing a file. Now when user installs ezhil, ezhili will be installed in the $PATH and can be invoked like any other command.

Example

krace@Kracekumars-MacBook-Pro ~/c/Ezhil-Lang> (ezhil) ezhili
எழில் - ஒரு தமிழ் நிரலாக்க மொழி (Fri Nov 20 08:00:00 EST 2015)
Ezhil : A Tamil Programming Language - version 0.8, (C) 2007-2015
Type "help", "copyright", "credits" or "license" for more information.
எழில் 1>> 1 + 1
2
எழில் 2>> ^D
******* வணக்கம்! பின்னர் உங்களை  பார்க்கலாம். *******
krace@Kracekumars-MacBook-Pro ~/c/Ezhil-Lang> (ezhil) ezhili tests/fibo.n
Fibo [1]  = 1
Fibo [2]  = 1
Fibo [3]  = 2
Fibo [4]  = 3
Fibo [5]  = 5
Fibo [6]  = 8
Fibo [7]  = 13
Fibo [8]  = 21
Fibo [9]  = 34
Fibo [10]  = 55

Now this command can be used for executing any snippet via subprocess or envoy.


In [1]: import envoy

In [2]: cmd = "ezhili tests/fibo.n"

In [3]: res = envoy.run(cmd, timeout=10)

In [4]: res.std_out
Out[4]: 'Fibo [1]  = 1 \nFibo [2]  = 1 \nFibo [3]  = 2 \nFibo [4]  = 3 \nFibo [5]  = 5 \nFibo [6]  = 8 \nFibo [7]  = 13 \nFibo [8]  = 21 \nFibo [9]  = 34 \nFibo [10]  = 55 \n'

In [5]: import subprocess

In [7]: res = subprocess.Popen(['ezhili', 'tests/fibo.n'], stdout=subprocess.PIPE)

In [8]: res.wait()
Out[8]: 0

In [11]: res.stdout.read()
Out[11]: 'Fibo [1]  = 1 \nFibo [2]  = 1 \nFibo [3]  = 2 \nFibo [4]  = 3 \nFibo [5]  = 5 \nFibo [6]  = 8 \nFibo [7]  = 13 \nFibo [8]  = 21 \nFibo [9]  = 34 \nFibo [10]  = 55 \n'
arcturusannamalai commented 8 years ago

Thanks for the wonderful piece of code @kracekumar ! I also request you to update the CREDITS file, and add yourself under AUTHORS.

One more request : please merge your commits using 'git rebase -i HEAD~5' etc.

After these two minor changes I am happy to merge your PullRequest.

kracekumar commented 8 years ago

Will make all changes and update.

kracekumar commented 8 years ago

I am done with changes.

arcturusannamalai commented 8 years ago

நன்றி!