Python Forum
help in creating a new language with python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help in creating a new language with python
#1
i am creating my own programming language (the name is codime) interpreter\compiler with python,but every time i want to compile\interpret my script written in my language,i need to go to cmd and key in

first,the directory.
then,run it like this:
python test.py test.codime

test.py(the interpreter create with python)
test.codime(stuff written in my language)

1)how to make it run by just clicking a run button in a text editor instead of needing to go the cmd and write the above comment line  again and again to run it?

2)how do i make it so that the interpreter that i am creating can only interpret file that have the .codime file extension?(like python can only compile file with  .py   extension.

i am a beginner, so please make the answer as detailed as possible  Smile ,but not too long word ,if possible.  Big Grin
thanks......
Reply
#2
(Dec-19-2016, 04:45 AM)hsunteik Wrote: (like python can only compile file with  .py   extension.
who says that python can only compile a file with .py extension?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#3
Normally, I will open a terminal, navigate to the directory I want, type in my program to run it the first time. After that, I just use the term's 'history' by hitting the up-arrow key and then enter.  Saves a little bit of typing.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#4
(Dec-19-2016, 01:41 PM)sparkz_alot Wrote: Normally, I will open a terminal, navigate to the directory I want, type in my program to run it the first time. After that, I just use the term's 'history' by hitting the up-arrow key and then enter.  Saves a little bit of typing.
dont you think clicking a button from the text editor is easier than going to cmd and run it.

(Dec-19-2016, 09:41 AM)Skaperen Wrote:
(Dec-19-2016, 04:45 AM)hsunteik Wrote: (like python can only compile file with  .py   extension.
who says that python can only compile a file with .py extension?
Does that mean that  python can also compile filename with( the( .txt) ,( .js ) ,(.c) ,( .class) ,( .jar)  and any other text file extension.)
i dont think so. Dance Naughty Big Grin
Reply
#5
(Dec-20-2016, 06:33 AM)hsunteik Wrote:
(Dec-19-2016, 09:41 AM)Skaperen Wrote: who says that python can only compile a file with .py extension?
Does that mean that  python can also compile filename with( the( .txt) ,( .js ) ,(.c) ,( .class) ,( .jar)  and any other text file extension.)
i dont think so. Dance Naughty Big Grin

Only the actual file contents count.... the file extension is a mere convention. People tend to stick to it because it is useful but it is in no way mandatory.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#6
Quote:dont you think clicking a button from the text editor is easier than going to cmd and run it.

Not really.  Your plain 'vanilla' text editors don't run scripts, nor are they meant to. More advanced editors can (such as Notepad++), but require a bit of work to set up.  Personally, I use PyCharm Community Edition (though there are several equally good IDE's) to write my scripts. This allows me to write and run the script from within the same environment the majority of the time.  A good place to start is here: Python IDE's.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#7
Quote:dont you think clicking a button from the text editor is easier than going to cmd and run it.
Nope. Once you start using the terminal, GUI is dreadfully slow and laggy. For everything in GUI there is a comparison in terminal. Terminal torrent clients, terminal browsers, Vim editor (which is what i use), and on and on. 

When i code, i popup a terminal, navigate to my files, open tmux to split the terminal, and in one i open in Vim, and the other split terminal i set aside for execution. Now every time i use an IDE i cant stand the slow loading and lag of the GUI. 

This is the same reason i avoid Windows like the plague. Because they prefer GUI over terminal (not the only reason). And sometimes you can really tell, and sometimes you can only tell when you have a linux box side by side a windows, you are already jumping into your program while Windows is still loading. 

Some linux users dont even install a display manager. Their whole computer is just a terminal. If your not programming something that requires a GUI (such as a visual game) you dont even need a display manager either.

Attached Files

Thumbnail(s)
   
Recommended Tutorials:
Reply
#8
Thanks for the answer,especially the one from ofnuts.
Reply
#9
(Dec-20-2016, 03:12 PM)metulbur Wrote: Some linux users dont even install a display manager. Their whole computer is just a terminal. If your not programming something that requires a GUI (such as a visual game) you dont even need a display manager either.

Looks like kate for cavemen :)

   
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#10
i use to use kate 5 years ago or so. Most IDE/text editors have an embedded terminal option...or plugin. But i meant the sole fact of reducing GUI programs completely. Although from what i remember i never had a problem with kate. Though ive had laggy programs in linux, i was more referring to windows.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  logo language code into python aayushi98 2 58,210 Jan-26-2021, 09:02 PM
Last Post: Serafim
  Correct Language for creating a calculation tool bradkernohan 2 1,523 Nov-29-2020, 09:01 AM
Last Post: DeaD_EyE
  Inconsistency in Python programming language? newbieAuggie2019 31 11,057 Oct-06-2019, 03:21 PM
Last Post: adt
  Terms describing Python Programming language leodavinci1990 3 2,654 Aug-12-2019, 02:48 PM
Last Post: leodavinci1990
  How to get image from WolframAlpha by using Python language manhnt 1 2,663 Oct-27-2018, 02:07 PM
Last Post: Larz60+
  How to make the python default language be 3.6 instead of 2.7 sylas 4 6,770 Jul-06-2018, 06:11 AM
Last Post: sylas
  [split] create a virtual keyboard of an unknown foreign language with python fakoly 0 2,364 May-28-2018, 01:34 AM
Last Post: fakoly
  Arabic language is backward in python charts bandar 3 3,524 Feb-23-2018, 07:10 AM
Last Post: Larz60+
  Learning Python "as a second language" with a MOOC Bass 6 4,958 Mar-25-2017, 02:30 PM
Last Post: Bass

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020