Page 4 of 5

Re: simple speed optimization request

Posted: Fri Jan 20, 2012 5:18 pm
by luis
@remi_meier

Fabulous suggestions IMHO, and the parser as a some kind of library would indeed be insanely awesome.

Re: simple speed optimization request

Posted: Fri Jan 20, 2012 10:59 pm
by kenmo
Can't some plugin-like functionality be achieved now by adding pre-processors to the IDE tools?

An enhanced plugin system would be great though -- a community-driven plugin forum would be awesome -- but this would probably need its own big discussion to work out the details.

I've had a few ideas for handy PB plugins but I always held off because I thought there was talk of overhauling the IDE tools system.... maybe I'm wrong.

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 1:22 am
by skywalk
Would the plug-in system be in addition to or a replacement of freak's proposed IDE automation?
http://www.purebasic.fr/english/viewtop ... 50#p343150
Fred wrote: I don't want of a 'so called' modern programming language because it doesn't fit with beginners.
Hi Fred,
I do think it may be time to reconsider what exactly a "beginner" is.
Many children today, including mine, are starting with java.
I see no reason for PureBasic to be held back for "beginners" sake.
Given you cannot please all people, all the time, enabling a plugin system could reinvigorate interest and add features that a small team could not achieve otherwise.

Thanks for PureBasic!

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 5:07 am
by freak
This thread shows exactly why so many feature request posts remain without a comment. There are simply too many people here who cannot accept anything other than "yes, right away" as an answer. As soon as I post anything different, all i get is personal attacks in response.

Well, I don't have to put up with that. If you rather like your posts unanswered, that is fine with me.


@Danilo:
I make a living writing enterprise level software (in Java, not that it matters). How much have you accomplished lately with your awesome pro skillz except trolling around this forum? (Consider that a rhetoric question.)

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 12:55 pm
by Danilo
freak wrote:@Danilo:
I make a living writing enterprise level software (in Java, not that it matters). How much have you accomplished lately with your awesome pro skillz except trolling around this forum? (Consider that a rhetoric question.)
I have accomplished nothing because i spend my time trolling around here.

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 2:52 pm
by remi_meier
kenmo wrote:Can't some plugin-like functionality be achieved now by adding pre-processors to the IDE tools?
Of course it can. The problem is the parser for the PB
language which is needed by most tools. You may want
to look at how much work was required to get a reasonably
working lexer for PB. PB has so many corner cases in its
syntax that it is nearly impossible to write a parser for it
that will parse the exact same way as the compiler does.
(I was tempted to code one many times, but always
backed off because of the work involved and the lack
of specification.)
IMO this is the reason why there will never be reliable
source-level tools available for PB.

Then again, tools working on PB source directly will never
implement stuff like efficient function-inlining, constant-
propagation or common sub-expression elimination because
they'd be required to parse the source, create some IR,
transform this IR and somehow be able to create PB source
again. No one will get that to work reliably.

Tools like my (now defunct) Optimizer work on the ASM
level directly. This would theoretically allow one to do anything,
but it is well known that optimizing on the lowest-level will never
be as fruitful as optimizing at a higher level like the IR. There
were many optimizations which were just impossible to
do there.
skywalk wrote:Would the plug-in system be in addition to or a replacement of freak's proposed IDE automation?
It would have nothing to do with it as far as I can tell. My
proposal works together with the compiler and has nothing
to do with the IDE (except for optional integration).

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 3:02 pm
by Ramihyn_
remi_meier wrote:Of course it can. The problem is the parser for the PB
language which is needed by most tools. You may want
to look at how much work was required to get a reasonably
working lexer for PB. PB has so many corner cases in its
syntax that it is nearly impossible to write a parser for it
that will parse the exact same way as the compiler does.
(I was tempted to code one many times, but always
backed off because of the work involved and the lack
of specification.)
IMO this is the reason why there will never be reliable
source-level tools available for PB.
Yeah, it's not fun to do. I have my own parser working for the language elements of PB which i actually use.

I guess we had the same goals, but i didnt see your lexer before i was already done with mine ;)

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 3:27 pm
by remi_meier
Ramihyn_ wrote:I guess we had the same goals, but i didnt see your lexer before i was already done with mine ;)
Nobody saw it, I had to watch people building their own
lexers many many times since then. That's why I stopped
updating it some time ago. Well I guess not searching in
the forums for an existing solution is kind of standard in
the PB community. I wouldn't have trusted an external
solution myself ;)
Then again, how many of those tools were successful?
I guess a good lexer would not have helped anyway :mrgreen:

Btw, are you sure about the done part? I was done
several times :lol: . Unfortunately I was too lazy to create
test cases which I could give to you :|

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 8:31 pm
by void
skywalk wrote:I do think it may be time to reconsider what exactly a "beginner" is.
Many children today, including mine, are starting with java.
I see no reason for PureBasic to be held back for "beginners" sake.
Personally, I highly object to java being taught as a first programming language because there are far too many concepts one must learn before you understand what all but the most trivial programs are doing. So much of the early time for a java student who has never programmed before involves, "What does that mean right there--" "Don't ask that now, just copy it, you'll see later." And later could be months down the road, or longer!

Whereas with something like purebasic, you can start with immediate results that can be explained plainly.

I used to teach programming through LogoWriter, and it had similar facets. Many students learn much more effectively if you can give them concrete 'type this, and that happens, here's what it's doing' examples earlier on.

The fact that we can produce functioning gui applications with less than a page of source code is something remarkable, and is of great value. Sure, that's going to leave out a lot of sanity checking, but for the purposes of learning the concepts this is invaluable, and it's easier to add things later than have things unexplained early on.

As for holding Purebasic back for "the sake of beginners", at the end of the day a hobbyist developer has to make what they personally believe in making.

If someone thinks the developers should be making something different, it probably won't accomplish much to just tell them the desired end result and insist "this is what it should be."

Better results could be met through understanding the goal and vision of the project as seen by the developers, and understand how something does (or does not) meet those desires.

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 8:56 pm
by xorc1zt
Whereas with something like purebasic, you can start with immediate results that can be explained plainly.
this made me laugh because purebasic is closed source so how you can "explain plainly" if you never seen the main code ?
best languages for beginners are python, lisp, ada, c, javascript+html5, php and pascal. those languages are simple and offer OOP as a option. if you begin with pb and want to try OOP you must learn another language.

Re: simple speed optimization request

Posted: Sat Jan 21, 2012 9:09 pm
by skywalk
void wrote:Personally, I highly object to java being taught as a first programming language because there are far too many concepts one must learn before you understand what all but the most trivial programs are doing.
void - I believe you "highly object" to poor teachers and not the subject or vehicle employed. The richness of a language cannot be at fault. So, to avoid injury or illogical outcomes, some training wheels may be deployed. But, isn't it great that once removed, the student can fly? :wink:
void wrote:If someone thinks the developers should be making something different, it probably won't accomplish much to just tell them the desired end result and insist "this is what it should be."
:? :?: This is the way of the world. Critics all. Are you suggesting mute acceptance of status quo?
I don't know how many times I have to say this... :evil: ...but it is high praise indeed for the existence of dissension and critique of one's product. Without critique, there is no innovation or worse, no market.

When I see impassioned suggestions(danilo,remi-meier,etc) I am encouraged, regardless of the delivery. My wish is the developers feel the same. :wink:

Re: simple speed optimization request

Posted: Sun Jan 22, 2012 4:35 am
by Ramihyn_
remi_meier wrote:Nobody saw it, I had to watch people building their own
lexers many many times since then. That's why I stopped
updating it some time ago. Well I guess not searching in
the forums for an existing solution is kind of standard in
the PB community. I wouldn't have trusted an external
solution myself ;)
I had never heard of any PB project or updates of your lexer during the last years, thats why i didnt even search for it on the forum. I simply didnt expect to find something useful :)
remi_meier wrote:Then again, how many of those tools were successful?
I guess a good lexer would not have helped anyway :mrgreen:
Define "succes"? ;)

I wrote them to find problems (bugs/crashes/performance hogs/resource leaks) in heavily multithreaded code where the PureBasic debugger doesnt even work anymore and my toolkit instantly pointed me at those problems. So for myself the tool was a necessity and it works perfectly.

But if you define "success" as being popular, widely used and highly praised - then no, they wherent any success at all ;)

Too bad that there isnt any market for PB tools, or i would have cleaned it up, added real documentation and sold it for a few bucks as an advanced debugger replacement or an add-on.
remi_meier wrote:Btw, are you sure about the done part? I was done
several times :lol: . Unfortunately I was too lazy to create
test cases which I could give to you :|
Define "done" ;)

I wrote them for my own projects and they cover 100% of the language constructs i use and need.

Things like advanced macro use or full support of preprocessor commands would be just a waste of time for me to implement. Somebody who uses them in a non-compatible way to my lexer, will just say it is broken because it doesnt treat the code like "PB does".

Nowadays i use reflection in C# or play with Cecil to do even more interesting runtime or compilation time changes. PB is pointless to me now due to only the windows version being actively supported.

Re: simple speed optimization request

Posted: Sun Jan 22, 2012 11:23 am
by remi_meier
Ramihyn_ wrote:I had never heard of any PB project or updates of your lexer during the last years, thats why i didnt even search for it on the forum. I simply didnt expect to find something useful :)
Yeah, that is a problem of my laziness. I started it in 2006
and the only (other) user of the lexer was in the German
forums, so I was too lazy to mark updates and fixes in the
English forums too. The last update was made in 2009.
Ramihyn_ wrote:
remi_meier wrote:Then again, how many of those tools were successful?
I guess a good lexer would not have helped anyway :mrgreen:
Define "succes"? ;)
I meant in widespread use. As you pointed out, this would
be the only reason to try to support every little quirk of PB :)
Ramihyn_ wrote:Too bad that there isnt any market for PB tools, or i would have cleaned it up, added real documentation and sold it for a few bucks as an advanced debugger replacement or an add-on.
Yeah, there is not even enough demand for free tools. I
made quite a few myself and albeit they fulfill quite
specialized needs, again I saw many people just doing
it on their own. I think my average tool has ~2 users
in the first year (including myself :mrgreen: ).
Ramihyn_ wrote:
remi_meier wrote:Btw, are you sure about the done part? I was done
several times :lol: . Unfortunately I was too lazy to create
test cases which I could give to you :|
Define "done" ;)

I wrote them for my own projects and they cover 100% of the language constructs i use and need.
You are right of course :P . I was just trying to hint at
how much work is needed to get a "compliant" PB
lexer. If we had the one that PB uses itself, there would
be nothing in the way of widespread use of a tool with
very high quality.


Cheers
remi

Re: simple speed optimization request

Posted: Sun Jan 22, 2012 6:08 pm
by Danilo
remi_meier wrote:I was just trying to hint at how much work is needed to get a "compliant" PB lexer.
I think you made it way too complicated. The lexer should return only simple tokens
like operators, identifiers, keywords, numbers, strings.
You did care for *pointers, %01010 and p-ascii in your lexer if i see it correctly,
but this stuff should be done in the parser imo.
Makes it much easier and the following is no problem:

Code: Select all

p=10:ascii=2

a = p-ascii ; p-ascii
b = p%%1000 ; % %1000
c = p**p    ; * *p

Debug a
Debug b
Debug c

Re: simple speed optimization request

Posted: Sun Jan 22, 2012 10:33 pm
by remi_meier
Danilo wrote:
remi_meier wrote:I was just trying to hint at how much work is needed to get a "compliant" PB lexer.
I think you made it way too complicated. The lexer should return only simple tokens
like operators, identifiers, keywords, numbers, strings.
You did care for *pointers, %01010 and p-ascii in your lexer if i see it correctly,
but this stuff should be done in the parser imo.
Makes it much easier and the following is no problem:

Code: Select all

p=10:ascii=2

a = p-ascii ; p-ascii
b = p%%1000 ; % %1000
c = p**p    ; * *p

Debug a
Debug b
Debug c
Of course you are correct, but that would imply that a
parser is required for it to be useful. My initial goal was
to be able to extract functions and variables, meaning
identifiers. Many (most?) lexers do some easy preparsing
anyway.

The first problem with that was of course the "$ C0FFEE"
or "% 10110". I needed to decide that both (especially
the HEX one) are numbers and not identifiers. So I needed
to look at the previous tokens too. In the same category
of problems is the part about '*p' being a different identifier
than 'p' and therefore treating * as an operator and returning
'p' as the identifier was unacceptable. Oh, and this dragged
in yet another problem:

Code: Select all

Define*p
Keywords are different in effect than identifiers, otherwise
'*' would be an operator again. Same with ".p-ascii" etc.

You see my goal was to provide a simple lexer which is
usable by itself. I could have added a trimmed-down parser
which made those decisions in another pass but you would
have to prove to me that this would have been simpler :wink:

I wouldn't argue for this approach if the intended use of the
lexer was together with a parser, but building a parser for
PB is again a much much greater task. And I just wanted
something useful :)