How to rewrite Julia programming language from scratch?

I want to change julia and add python like features to it.
Make syntax look like Python but inside it is Julia compiler-based.
Is it possible?
How can I do this?
Thank you :slight_smile:

Welcome @vedasulo,
This is going to be an interesting thread I assume! Not an easy first question :wink:



What kind for example?

1 Like

It’s definitely possible to write a Python parser that gives new semantics to Python syntax and calls out to Julia for execution. It will be a lot of work, though – but doing it on your own would be a great learning experience.


Why do you want to do this? Julias syntax is already quite nice, often nicer than Pythons :wink:

For speeding up Python code, there is e.g. Numba, which works technically similar to Julia (type inference, LLVM). Ultimatively, it is limited by the Python syntax, which was never designed for speed.


Or with a transpiler approach like Vala, source code to C/C++ or similar and then convert it into an executable file. Vala can do more than C, although it is translated to C with the help of GObject. Depends on what you want but better than Java despite similar syntax in the object-oriented approach

1 Like

wow it is build just in 2020.
I am wandering if it is possible :slight_smile:

:slight_smile: like everything why python makes the best programming language.

This is answered in the Julia FAQ


I was just going to post the same link, but you beat me to it :grin:.

That said, if you just want Julia’s surface syntax to look more python-like, “all you would need to do” is replace this file, which contains Julia’s parser with your own parser that translates a syntax oriented after Python to Julia’s s-expression like AST and then just plug that into all the later stages of the compiler. That said, this is likely quite a bit of work and it’s not clear whether it will actually be worth it, since the new language you will just have invented might look a lot like Python on the surface, but will still inherit everything else about Julia’s behavior, that makes it different from Python. You won’t just be able to run any non-trivial Python code with your new language, but you would still have to rewrite large parts of it, and a language that looks like Python, but doesn’t behave like Python might end up being more confusing to Python users than just learning a new language.


Thank you @stevengj and all guys.
It is not possible may, be because as people told, it is hard to manage syntax with julia when syntax is converted to python.

I am not sure what that means, but syntax here is a red herring. What makes Julia special is its semantics, that could — in principle — accommodate a wide variety of surface syntaxes. See eg


If you want to create Python-like Language with some features of Julia, but the advantages of Julia lie in front-end, not the back-end, as it is explained in the pointed-out manual, then why cannot you just work on your language exprwhich are implemented in interpreted languages, then essions until you can generate a code of Julia, which won’t mean you generating lot’s of Julia code for one python line?

If Julia’s advantage is that it does not use some special features, which are implemented in interpreted languages, then make this syntax more complicated and hard in your language.

Me myself I am also hacking something about Julia, because I don’t like, why it cannot let me iterate over Complex objects - I solved definitely, why I can iterate over Complex numbers. All the functions I use are very definite they don’t fail any theorem there.

you can ‘add’ syntax with macros, if what you want are specific idioms, which is usually what people mean when they say ‘pythonic’, i think.

It could be fun to write a string macro to accept “pythonic julia” and emit actual julia. I wonder how far you could get before an insurmountable problem. Maybe you’d start by making indentation meaningful so you could write

function f(x, y):
    if x>2:
        return y
        return 2*y

and it would transform to

function f(x, y)
    if x>2
1 Like