Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic Popularity - Page 5 — Parallax Forums

PropBasic Popularity

1235

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-23 10:07
    Rayman wrote: »
    For a professional IDE, nothing beats Visual Studio (IMHO). Maybe Mac has something like it, I don't know.
    I've figured out how to code for PropGCC inside Visual Studio and I must say it's a real pleasure, compared to the other tools.

    So, if it were me, I'd be inclined to see if the Visual Basic IDE could be used for PropBasic code...
    Just as a test, I created a new VB project for the "Console".
    Here's what VB gives you automatically:
    Module Module1    
        Sub Main()
        End Sub
    End Module
    

    Anyway, if that type of format could be used, maybe one could use VB for the editor and then get someone to make us a Basic2Cpp program...
    How about this?
    def fibo(n)
        if n < 2 then
            return n
        else
            return fibo(n-1) + fibo(n-2)
        end if
    end def
    
  • Heater.Heater. Posts: 21,230
    edited 2013-05-23 10:16
    Module Module1
        Sub Main()
        End Sub
    End Module
    
    def fibo(n)
        if n < 2 then
            return n
        else
            return fibo(n-1) + fibo(n-2)
        end if
    end def
    

    Are you guys discussing the same language? They look so different.

    Neither of them look like any BASIC I have ever seen.

    If that is the level of standardization in BASIC land I think the whole project is doomed:)
  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-23 10:20
    Heater. wrote: »
    Module Module1
        Sub Main()
        End Sub
    End Module
    
    def fibo(n)
        if n < 2 then
            return n
        else
            return fibo(n-1) + fibo(n-2)
        end if
    end def
    

    Are you gus discussing the same language? They look so different.

    Neither of them look like any BASIC I have ever seen.

    If that is the level of standardization in BASIC land I think the whole project is doomed:)
    I apologize. Mine was an example of xbasic code. What we really should be talking about here is either PropBasic or pbasic 2.5 or whatever the latest version of that is. I need to dig up a definition of those two languages to better understand the original topic of this thread.
  • RaymanRayman Posts: 14,665
    edited 2013-05-23 10:27
    What I meant to say is that I'm able to use the really nice Visual Studio IDE for editing PropGCC code, even though Visual Studio isn't really designed for that...

    So, perhaps the Visual Basic and PropBasic syntaxes are similar enough that one could use the Visual Studio IDE to edit PropBasic code...
  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-23 10:31
    Rayman wrote: »
    What I meant to say is that I'm able to use the really nice Visual Studio IDE for editing PropGCC code, even though Visual Studio isn't really designed for that...

    So, perhaps the Visual Basic and PropBasic syntaxes are similar enough that one could use the Visual Studio IDE to edit PropBasic code...
    That might be true but unfortunately that results in a Windows-only solution. I think Parallax is after cross-platform tools at this point.
  • KC_RobKC_Rob Posts: 465
    edited 2013-05-23 10:37
    David Betz wrote: »
    That might be true but unfortunately that results in a Windows-only solution. I think Parallax is after cross-platform tools at this point.
    Ditto. It probably would be better to stay away from something Windows specific, and I did get the impression that cross-platform was the goal (nothing against Windows or VS).
  • Heater.Heater. Posts: 21,230
    edited 2013-05-23 10:37
    Visual Studio does not fit this picture.

    Parallax has belatedly embraced the open source world and has made great progress there. Visual Studio is a dead end, closed source product from a company that is about to implode
    [*] and is not a reputable outfit that we should be supporting anyway.


    * Yes, you heard it here first:)
  • KC_RobKC_Rob Posts: 465
    edited 2013-05-23 10:45
    jones wrote: »
    Quote from ersmith in the benchmark thread: "In LMM mode GCC does not generate djnz, so its loop is a bit bigger (using a cmp and branch). The loop does fit into the FCACHE area in the COG and so executes without LMM overhead, which explains why GCC's LMM time is close to PropBasic's COG time."
    Interesting. Thanks for pointing this out. I need to go through the entire thread when I have time.
  • jmgjmg Posts: 15,173
    edited 2013-05-23 16:37
    Rayman wrote: »
    For a professional IDE, nothing beats Visual Studio (IMHO). Maybe Mac has something like it, I don't know.
    I've figured out how to code for PropGCC inside Visual Studio and I must say it's a real pleasure, compared to the other tools.

    Here you are using IDE to mean Editor, and yes there are many smart editors out there.
    It is not easy to find a powerful one that works equally well on Windows/Mac/Linux, but a good Tools Framework should allow External Editors.

    A (very) good external windows based editor, with customer syntax highlighting support, is
    http://notepad-plus-plus.org/
    So that can support ANY dialect or variant one cares to set up.


    However, an editor is a small part of a full Integrated Development Environment, which should also include Download capability, and better ones also have Simulators built in plus good help and examples.

    It would help if users explained what IDE means to them.
  • jmgjmg Posts: 15,173
    edited 2013-05-23 17:02
    David Betz wrote: »
    I'm not sure any of the block delimiter approaches is idea. I think the best way to avoid "swimming in delimiters" is to factor your code into relatively small functions/methods so that the code isn't too deeply nested.

    Discussions on 'The ideal delimiters' are largely academic, as a useful language has to be compatible with others.

    Also, a good modern editor has Syntax highlighting, and can find matching elements ( be it () , or {} or begin end or whatever ), and some have expand/contract on code blocks.


    If you want a single document with many good 'current' Basic Syntax example, that compiles in a PC and does serious work, look at :
    http://www.freebasic.net/forum/viewtopic.php?f=8&t=13935&hilit=fbdebugger

    To me, targeting a subset of that, makes the most sense.
    With support for
    #Ifdef
    #EndIf etc
    users can wrap any non-portable details.
    David Betz wrote: »
    Of course, there may be a performance hit for that unless you use inline functions.

    True, but good tools will inline almost automatically , or let the user control what in-lines, so there is no overhead for clarity.
  • KC_RobKC_Rob Posts: 465
    edited 2013-05-23 17:50
    jmg wrote: »
    Also, a good modern editor has Syntax highlighting, and can find matching elements ( be it () , or {} or begin end or whatever ), and some have expand/contract on code blocks.
    True. With modern tools this is even less an issue nowadays from a practical coding standpoint. Still, it's a bit more than an academic discussion, I would argue, when you consider the many different ways extant workaday languages use to delimit blocks and control structs: from nothing but whitespace, to braces, to differing levels of verbiage.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-23 18:46
    jmg wrote: »
    If you want a single document with many good 'current' Basic Syntax example, that compiles in a PC and does serious work, look at :
    http://www.freebasic.net/forum/viewtopic.php?f=8&t=13935&hilit=fbdebugger
    I looked at that language description and it reminded me of something I dislike about the Microsoft Basic variants. They use two word keywords like "end if" and "end select" but for the "while" statement they use "wend". Why not "end while" to be consistent?
  • RaymanRayman Posts: 14,665
    edited 2013-05-23 19:18
    I think I like FreeBasic! I wrote a lot of stuff in QB and a quick look says that should directly compile...
    Wonder if they have a good editor...

    Just to be clear: I'd never really go back to BASIC, but it's where I started from and I'm glad to see it still around...
  • RaymanRayman Posts: 14,665
    edited 2013-05-23 19:21
    BTW: I love their "hello world" comparison with C/C++... It really shows why people like BASIC:

    hello world
    C
    #include <stdio.h>
    int main() {
    printf("Hello!\n");
    return 0;
    }
    
    
    

    BASIC
    print "Hello!"
    
  • jmgjmg Posts: 15,173
    edited 2013-05-23 21:35
    David Betz wrote: »
    I looked at that language description and it reminded me of something I dislike about the Microsoft Basic variants. They use two word keywords like "end if" and "end select" but for the "while" statement they use "wend". Why not "end while" to be consistent?

    True, but that wil be lost in the mists of time...

    I tried End While and the FBC compiler spits

    error 34: Illegal 'END', found 'End' in 'End While'
    error 31: Expected 'WEND', found 'end' in 'end sub'

    so it is reasonably clear, should anyone guess at End While.
  • jmgjmg Posts: 15,173
    edited 2013-05-23 21:57
    Rayman wrote: »
    I think I like FreeBasic! I wrote a lot of stuff in QB and a quick look says that should directly compile...
    Wonder if they have a good editor...

    There seem to be two : FbEDIT and FbIDE.
    Both have syntax highlighting, and Sub/function listing, and FbEDIT includes expand/collapse source.

    Both seem to have external Compiler settings, with FbIDE a little easier to follow, at a glance.
    It has fields for Compiler path, compiler command, and run command

    Both are Open Source, on SourceForge. Just seems a good starting or reference point.

    Rayman wrote: »
    Just to be clear: I'd never really go back to BASIC, but it's where I started from and I'm glad to see it still around...

    I find it is good for quick COM port tests, and doing usage examples to give to end users.
    It has a very compact install, the bin\ folder I see is just 6MB
  • ColeyColey Posts: 1,110
    edited 2013-05-24 00:09
    I thought this thread was supposed to be about the popularity of PropBASIC.

    Just sayin......
  • jmgjmg Posts: 15,173
    edited 2013-05-24 01:16
    Coley wrote: »
    I thought this thread was supposed to be about the popularity of PropBASIC.

    Just sayin......

    It is, but if you read further (eg #10) you will find that the reason the OP is asking, is with a view to develop a PropBASIC IDE.

    Given that, it makes good sense to checkout other Basic IDEs/Editors/Environments, especially Open Source ones. :)
  • ersmithersmith Posts: 6,054
    edited 2013-05-24 02:04
    David Betz wrote: »
    I'm not sure if the top post was kept up to date but from that it seems that PropBasic is a hair faster in COG mode and significantly slower in LMM mode.

    Yes, the top post was kept up to date with the results of the thread. PropBasic is very impressive, and it's possible to produce some very fast programs with it; my impression is, though, that you have to code carefully to get the best performance. I think the advantage of PropGCC is that the optimizer can take even poorly written programs and produce good output. But I'm biased :-).

    Eric

    PS: the compilers have probably changed since the time of that thread. PropGCC, for example, can now emit djnz for FCACHE'd loops in LMM mode, so its LMM performance should be better.
  • RaymanRayman Posts: 14,665
    edited 2013-05-24 04:18
    jmg wrote: »
    Given that, it makes good sense to checkout other Basic IDEs/Editors/Environments, especially Open Source ones. :)

    Exactly. Maybe Batang already has this problem solved. But, if there's an open source/cross platform BASIC IDE around that allows external compilers...
    All you really need is the PropBasic compiler to make it work...
  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-24 04:36
    ersmith wrote: »
    Yes, the top post was kept up to date with the results of the thread. PropBasic is very impressive, and it's possible to produce some very fast programs with it; my impression is, though, that you have to code carefully to get the best performance. I think the advantage of PropGCC is that the optimizer can take even poorly written programs and produce good output. But I'm biased :-).

    Eric

    PS: the compilers have probably changed since the time of that thread. PropGCC, for example, can now emit djnz for FCACHE'd loops in LMM mode, so its LMM performance should be better.
    What do you think about the idea of making a basic2cpp translator? Would you have to translate the entire Basic program as a single C function given the heavy use of GOTO and GOSUB in Basic programs? How well does the PropGCC optimizer work on large functions? Would it be possible to annotated the translated source with line number information to help with source level debugging?
  • ersmithersmith Posts: 6,054
    edited 2013-05-24 05:08
    David Betz wrote: »
    What do you think about the idea of making a basic2cpp translator?

    You mean like the ones at http://www.basic-converter.org/ or http://qbasictoc.sourceforge.net/? I haven't tried either of those, but it would be interesting to see how well they work. The first one specifically targets GCC and is cross-platform, so it might work well (it requires bash or ksh, though, so you'd have to use cygwin on Windows).
  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-24 06:15
    ersmith wrote: »
    You mean like the ones at http://www.basic-converter.org/ or http://qbasictoc.sourceforge.net/? I haven't tried either of those, but it would be interesting to see how well they work. The first one specifically targets GCC and is cross-platform, so it might work well (it requires bash or ksh, though, so you'd have to use cygwin on Windows).
    Yeah, I guess there are a bunch of those around already. No need to build one ourselves. I guess the only reason would be if we want something that duplicates pbasic on the stamps or something like that.
  • TorTor Posts: 2,010
    edited 2013-05-24 06:35
    Heater. wrote: »
    Further along there may be issues in debugging. How do you match up the generated code back to the original BASIC source code?
    That is actually possible to overcome. The generated code can be filled up with #line preprocessor directives which match the original source. I believe this is what gcc itself does for the generated assembly code although I can't for the moment recall the option to show them if you use -S to generate assembly. In any case, adding #line to your source overrules whatever the compiler normally does. As a test I wrote a quick simple "compiler" for a language exactly like C, except that it doesn't need to include stdio.h, it doesn't need the 'main' definition, the braces or the 'return (0);' at the end. So the rest is C. Thus a simple compiler can be written in a few lines of Perl..
    I let my test program crash with a b = 2 / 0; statement, then looked at the core dump with gcc. It came out with the line number matching the one in my toy language source file, not the line number of the generated C file. Although gdb still insisted using the C file as source - but that can be fixed too, gdb has been used like this for other C-as-intermediate languages before. For example Vala (http://live.gnome.org/Vala/), which compiles via C. When using 'gdb' on the executable it correctly picks up the .vala source file and single-steps as you would expect.

    -Tor
  • MicksterMickster Posts: 2,694
    edited 2013-05-24 07:04
    David Betz wrote: »
    given the heavy use of GOTO and GOSUB in Basic programs

    Huh?

    I have never used a GOTO or a GOSUB since I started using QuickBASIC 2.0 in 1986! It had "Sub Programs" and "Functions" along with "Local", "Shared", "Common Shared" and "Global" variables.

    Furthermore you can compile to .obj's and link with other .obj's created with other languages (I used MASM for time-critical stuff and linked with the QB modules).

    Cheers!

    Mickster
  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-24 07:09
    Mickster wrote: »
    Huh?

    I have never used a GOTO or a GOSUB since I started using QuickBASIC 2.0 in 1986! It had "Sub Programs" and "Functions" along with "Local", "Shared", "Common Shared" and "Global" variables.

    Furthermore you can compile to .obj's and link with other .obj's created with other languages (I used MASM for time-critical stuff and linked with the QB modules).

    Cheers!

    Mickster
    I know "modern" Basics don't use GOTO or GOSUB but I believe that with pbasic GOSUB is the only way to call a subroutine .

    Edit: It seems that PropBASIC supports named subroutines and functions with parameters. I hadn't realized that before. Sorry!
  • KC_RobKC_Rob Posts: 465
    edited 2013-05-24 08:20
    Coley wrote: »
    Please keep it away from C, there's a reason people prefer BASIC, you are just adding another level of complexity if you do that.
    In any case, PropBASIC is one of the fastest compilers around....
    The opinion of, I gather, a PropBASIC user; it bears repeating. There are, of course, pluses and minuses to doing it either way. But PropBASIC does seem capable of standing on its own so to speak.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-24 08:29
    KC_Rob wrote: »
    The opinion of, I gather, a PropBASIC user; it bears repeating. There are, of course, pluses and minuses to doing it either way. But PropBASIC does seem capable of standing on its own so to speak.
    I think the OP's comment "PropBASIC is one of the fastest compilers around" is interesting. Within limits, my preference would always be for the compiler that produces the best code not the one that finishes first. Of course, that depends on what difference is. A compiler that completes in one second will be used a lot more than one that completes in one minute. I don't think we're talking about that kind of difference here though. A basic-to-c translater followed by a run of propgcc not likely to be all that much slower than a run of the PropBASIC compiler. Anyway, when coding in Basic the first concern may not be raw execution speed so maybe it is better to stick with PropBASIC because it produces more readable PASM code.
  • BatangBatang Posts: 234
    edited 2013-05-24 08:42
    David Betz
    I think the OP's comment "PropBASIC is one of the fastest compilers around

    As the OP my only comment so far is I think the PopBasic compiler is a brilliant piece of code.

    Cheers.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-05-24 09:01
    Batang wrote: »
    David Betz

    As the OP my only comment so far is I think the PopBasic compiler is a brilliant piece of code.

    Cheers.
    Sorry, I meant Coley's comment quoted by RC_Rob. But, I agree that PropBasic is a brilliant piece of code!
Sign In or Register to comment.