Python Forum
how to make my programming language run as itself - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: how to make my programming language run as itself (/thread-1265.html)

Pages: 1 2


how to make my programming language run as itself - hsunteik - Dec-19-2016

currently,my programming language compiler(codime) is made using python ,so it needs python to run,
so how do i make my programming language compiler run as itself to compile .codime programming language


RE: how to make my programming language run as itself - ichabod801 - Dec-20-2016

I'm confused. You built a compiler in an interpreted language? What does it compile to?


RE: how to make my programming language run as itself - hsunteik - Dec-20-2016

sorry for such confusing question,i will try to break it down.
1)i am creating a programming language named codime.
2)i created codime compiler using python lexer and parser.
3)Because it is created using python,it needs python to run.
4)how do i make the compiler run without python(make the codime compiler run with codime(itself) instead of python)


RE: how to make my programming language run as itself - micseydel - Dec-20-2016

Are you sure it's not an interpreter? If it compiles, what does it compile to? (Python is interpreted, but compiles to bytecode, whereas in college we wrote a Lisp interpreter in Java, which doesn't create intermediate bytecode).

In any case, you should look into bootstrapping, but I'm not sure your goal is necessarily achievable without compromises and caveats.


RE: how to make my programming language run as itself - ichabod801 - Dec-20-2016

I'm still not quite sure what your doing. You could look into something like py2exe, but I think a better bet would be to use the Python code as a basis to rewrite the compiler/interpreter in a compiled language like C++. This is a not uncommon development cycle.


RE: how to make my programming language run as itself - hsunteik - Dec-21-2016

Yes,bootstrapping is what I am looking for,thanks.
But,how is it done,tutorial please?


RE: how to make my programming language run as itself - micseydel - Dec-21-2016

(Dec-21-2016, 04:02 AM)hsunteik Wrote: tutorial please?
The reason you've been asked repeatedly what you're compiling to is that we're really skeptical you've written a compiler. I suspect you've written an interpreter. You can't bootstrap an interpreter, because the whole idea with this particular kind of bootstrapping is to use the previously compiled binary, but if you're not producing a binary, you can't bootstrap.

So, if you want a better answer than that, you must answer this question: What are you compiling to?


RE: how to make my programming language run as itself - hsunteik - Dec-21-2016

I am following this tutorial series by howcode:
https://m.youtube.com/watch?v=pWAxiKdJF0c

The tutorial is about recreating basic with Python,but instead of basic ,I am creating a entirely new programming language.


Sorry,I don't know how to answer your question because me myself don't know.

may be the video above can answer the question?


RE: how to make my programming language run as itself - ichabod801 - Dec-21-2016

You've written an interpreter. The guy in the tutorial repeatedly refers to it as an interpreter.

What you could do, as I had suggested, is to redo your interpreter in a compiled language like C++ or Rust. Then you would get an .exe of your interpreter, and you could pass you codime program to the .exe to be interpreted. Then people wouldn't need Python, although they would need the .exe file.


RE: how to make my programming language run as itself - hsunteik - Dec-22-2016

Can I make it using python and then convert it to. exe using some software (py2exe)or method(using iexpress in window) or
Is it a must to make the interpreter in a compiled language.