Two-pass compile to bypass Declare?

Just starting out? Need help? Post your questions and find answers here.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Two-pass compile to bypass Declare?

Post by Mistrel »

Is it possible to do a two-pass compile that will "Declare" all of my functions for me?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Two-pass compile to bypass Declare?

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post 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.
Dare2 cut down to size
Max
User
User
Posts: 67
Joined: Thu Nov 30, 2006 4:57 pm
Location: I long for the absolute loneliness of the death

Post 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.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post 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.
~I see one problem with your reasoning: the fact is thats not a chicken~
Post Reply