Python Forum

Full Version: how to make my programming language run as itself
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
I'm confused. You built a compiler in an interpreted language? What does it compile to?
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)
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.
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.
Yes,bootstrapping is what I am looking for,thanks.
But,how is it done,tutorial please?
(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?
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?
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.
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.
Pages: 1 2