Posts: 113
Threads: 52
Joined: Dec 2016
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  ,but not too long word ,if possible.
thanks......
Posts: 4,646
Threads: 1,493
Joined: Sep 2016
(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.
Posts: 1,298
Threads: 38
Joined: Sep 2016
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
Posts: 113
Threads: 52
Joined: Dec 2016
Dec-20-2016, 06:33 AM
(This post was last modified: Dec-20-2016, 06:43 AM by hsunteik.)
(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.
Posts: 687
Threads: 37
Joined: Sep 2016
(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. 
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
Posts: 1,298
Threads: 38
Joined: Sep 2016
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
Posts: 5,151
Threads: 396
Joined: Sep 2016
Dec-20-2016, 03:12 PM
(This post was last modified: Dec-20-2016, 03:14 PM by metulburr.)
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:
Posts: 113
Threads: 52
Joined: Dec 2016
Thanks for the answer,especially the one from ofnuts.
Posts: 687
Threads: 37
Joined: Sep 2016
(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
Posts: 5,151
Threads: 396
Joined: Sep 2016
Dec-21-2016, 01:07 AM
(This post was last modified: Dec-21-2016, 01:07 AM by metulburr.)
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:
|