brain-labs / brain

An esoteric programming language compiler on top of LLVM based on Brainfuck
https://brain-labs.github.io/brain/docs/html/index.html
GNU General Public License v3.0
133 stars 19 forks source link

Binary generation #25

Closed rafaelcn closed 7 years ago

rafaelcn commented 8 years ago

The compiler should also, besides being a JIT compiler, read a brain file and generate an executable, the discussion is concerned on to whether the compiler should generate it only when requested, throught a flag, or it would generate the binary when called, like gcc and other compilers do.

luizperes commented 8 years ago

I will add this issue to the milestone 1.0

rafaelcn commented 8 years ago

Really? Shouldn't we put another milestone to implement our new ideas and close the 1.0 ASAP? The dead line is tight!

luizperes commented 8 years ago

@rafaelcn OK! You've got a strong point there! Thanks for this issue, though! :)

ryukinix commented 8 years ago

Nice issue

rafaelcn commented 8 years ago

So as you all are here you should help to decide which one of the behavior we should implement:

  1. Generate a binary file only when asked? Solution using a flag, something like --out=<bin_name>
  2. Generate a binary file when called the compiler over a file.

Vote! I'm to the 1 option.

ryukinix commented 8 years ago

I vote to do like others interpreters. Like lisp and python. -c flag denotes compile to machine language and save the file for standard like source-name.bc

ryukinix commented 8 years ago

considering the usage of extension b as the natural extension for brain

luizperes commented 8 years ago

I agree with @ryukinix regarding using flags! :)

But only making a point here, Brain extensions are .b, .br and .brain and I think that we should include .bf, as Brainfuck itself uses .b and .bf.

luizperes commented 7 years ago

I will also add .wit

rafaelcn commented 7 years ago

Why .wit?

luizperes commented 7 years ago

Wit is a form of intelligent humour, what is close to what Brain is. It is also 3 chars long, as mentioned and proposed by @leonardo neumann

luizperes commented 7 years ago

Included .bf and .wit on https://github.com/brain-labs/brain/commit/fa350046475298f0a2528bc38cb03a5f43668951

luizperes commented 7 years ago

We are generating the *.o file at the https://github.com/brain-labs/brain/commit/70fbef26bc237a484d4635a2d3c961dbbd627be2 . I believe that I will leave like that, once clang itself uses ld - Explanation here and other people use gcc - Explanation here. There is still other ways of doing that, but all of them use external tools and I don't like it. For that, I think that I will leave up to the user to use a Makefile and this would also solve https://github.com/brain-labs/brain/issues/15. What do you guys think?

luizperes commented 7 years ago

Brain now has 3 new flags to solve this issue:

We will not generate binary directly because of the problem that I mentioned above. Checkout the commit https://github.com/brain-labs/brain/commit/b3ebaeda2babefa377c9bc3e249070dc85ec4bb3