Page 1 of 1

Two-pass compile to bypass Declare?

Posted: Sat Jun 30, 2007 11:23 pm
by Mistrel
Is it possible to do a two-pass compile that will "Declare" all of my functions for me?

Re: Two-pass compile to bypass Declare?

Posted: Sun Jul 01, 2007 12:06 am
by PB
No, and it's not planned, and it's the reason why "Declare" exists. Please use
the "Search" function here as the topic has been discussed many times before.

Posted: Sun Jul 01, 2007 2:09 am
by Mistrel
I did do a search but it's difficult to search for something as arbitrary as "Declare". I couldn't find any other useful keyword to narrow my search.

I already posted a feature request that would make searching the forum easier in some cases.

Posted: Sun Jul 01, 2007 2:34 am
by Dare
Hi Mistral.

Closest thing I can think of is that the JaPBe editor creates a file of "declares" for you. I haven't used JaPBe for a while but I assume it still does this.

Two pass would be very good for many reasons but I don't think it is going to happen any time soon because:

(a) The compiler would need to be modified
(b) People think one-pass = sexy and leet. Because back in days of paper tape input it was. :D

However you never know your luck!

Although "this is not a democracy" (to quote a man I respect greatly) PureBasic is a commercial product so public opinion must have a bearing as the objective is to sell the ruddy thing. So I, for one, am glad you made this a request and didn't just accept the status quo.

Posted: Sun Jul 01, 2007 8:48 am
by Max
You can make a pre-compiler program what "prepares" source code and adds some data to it, like "Declares", and some other you can need... think about this and you will discover a lot of constructs what you repeat in every program.

Besides, in very big programs with a lot of "include" what "include" more and more subprograms, it's absolutely necessary to "sort" the source, first constants, second structures .... Your pre-compiler can make this.

Later, the pre-compiler invokes the compiler with newly created source.

You can make your own pre-compiler... I've done it.

Posted: Sun Jul 01, 2007 10:08 am
by PB
> I couldn't find any other useful keyword to narrow my search

A search for "single pass compiler" has many matches, most notably these:

http://www.purebasic.fr/english/viewtopic.php?t=14971
http://www.purebasic.fr/english/viewtopic.php?t=17861
http://www.purebasic.fr/english/viewtopic.php?t=22754
http://www.purebasic.fr/english/viewtopic.php?t=4994

As you can see, discussed VERY heavily from both parties wanting it, and
those not wanting it. BTW, I meant no disrespect when I asked you to
search; it's just that I know you're new here so I wanted to guide you. :)

Posted: Sun Jul 01, 2007 1:00 pm
by Killswitch
I agree that using 'Declare' is annoying, and that a pre-compiler would be the best way to get rid of it.

A reckon Fred and the boys should create a structure by which pre-compilers can be used more easily (perhaps even an official one!), setting it up as a tool via the editor is a bit of a pain and only works with some editors.