bython icon indicating copy to clipboard operation
bython copied to clipboard

Bootstrapping

Open oleorhagen opened this issue 7 years ago • 5 comments

Bython should be able to parse itself, and not rely on filthy regular python in doing so!

oleorhagen avatar May 15 '18 13:05 oleorhagen

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.

b1f6c1c4 avatar May 22 '18 09:05 b1f6c1c4

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 -c flag 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 avatar May 22 '18 10:05 mathialo

@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)

  1. Bython transpiler itself (source code) should be written in bython, not python because bython is much better as a language;
  2. Whenever a new version of Bython is to be released, we impose an older version of Bython on the source code to obtain python binaries (yeah python IS human-readable, but not SO readable as bython 😏 );
  3. The binaries are published. Anyone who wants to use Bython can simply download the binaries, copy them to /usr/local/bin, run bython -c, ...

b1f6c1c4 avatar May 22 '18 11:05 b1f6c1c4

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

b1f6c1c4 avatar May 22 '18 12:05 b1f6c1c4

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).

mathialo avatar May 23 '18 10:05 mathialo