Bootstrapping
Bython should be able to parse itself, and not rely on filthy regular python in doing so!
Definitely. Yet there is a critical bug ( #14 ) that MUST be fixed. After that, x.py SHOULD by semantically identical to bython -c (py2by x.py). Then we can initiate transpilation (and manual minor modification) from src/*.py to src/*.by.
There are a couple of real advantages of relying on regular python for parsing, these include:
- All modules for Python automatically work for bython as well (I'm doing a lot of scientific computing, so having the scipy-stack available is necessary). No inbetween translators is necessary.
- All language features of Python is available as soon as Python is updated. There's a reason that e.g. PyPy is still on 3.5 and not on 3.6, it's because they have to rewrite everyting, and that's a huge amount of work. You want fancy substitution of variables in strings as introduced in 3.6? You got it, no need to update Bython.
- Now, it's up to the users what parser they want to use. Want to combine Bython with Cython? No problem. What about PyPy? Not an issue. Simply compile with the
-cflag and run with your interpreter of choice.
Bython was simply meant as a translator from curly braces to indentation, and I think it's best to keep it like that and use other software for the interpreting.
@mathialo Basically, bootstrapping here (in my opinion) means:
(here bython is a language just like C, while Bython is a bython-to-python compiler just like GCC)
-
Bythontranspiler itself (source code) should be written in bython, not python because bython is much better as a language; - Whenever a new version of
Bythonis to be released, we impose an older version ofBythonon the source code to obtain python binaries (yeah python IS human-readable, but not SO readable as bython 😏 ); - The binaries are published. Anyone who wants to use
Bythoncan simply download the binaries, copy them to /usr/local/bin, runbython -c, ...
| Concept | In Bython v0.x | In Bython v1.x | In GCC |
|---|---|---|---|
| High-level language | bython | bython | C |
| Compiler | Bython | Bython | GCC |
| Low-level language | python | python | machine code |
| Compiler source code is written in | python | bython | C |
| Does compiler need compilation | No | Yes | Yes |
| Compiler binary is in | python | python | machine code |
Ah, I see, I misunderstood. Of course, I think that should be a goal. I also agree on your table above that we keep Bython 0.x written in Python for now, but it should be written in Bython and compiled to Python as of version 1.0 (whenever that may be).