Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Oxygen and Basic syntax

  1. #11

    Re: Oxygen and Basic syntax

    Here is my proposal:

    O2 will incorporate basic syntax, highly compatible with thinBasic. This will allow speed-critical sections of thinbasic source code to be dropped into Oxygen where they can be compiled and executed in machine code instead of going through the interpreter.

    I have sketched out a system for doing this and it is entirely feasible to incorporate a small Basic compiler into the Oxygen module taking its present size of 135k up to around 200k.

    With thinBasic 1.7, the functions can be declared and and used in the normal way.

    [code=thinbasic]

    uses "OXYGEN"

    dim src as string

    src="
    basic
    (
    function arith(byval a as long, byval b as long, byval c as long) as long
    function=a+b*c
    end function
    )
    "

    o2_asmo src

    if len(o2_error) then msgbox 0,"Problem: "+o2_error()+o2_view (src) : stop

    Declare Function arith(byval a as long, byval b as long, byval c as long) at o2_buf 0

    msgbox 0,arith(1,2,3)

    [/code]

  2. #12

    Re: Oxygen and Basic syntax

    Wow Charles. I'm watching this for a long time...

    O2 will incorporate basic syntax, highly compatible with thinBasic.
    and that would become very interesting. right now I'm working on my own AStar Pathfinding routines in thinBasic. Of course, it is slower than compiled code. I'm sure I want to try this in Oxygen. That should give it the speed burst it needs.

    Keep up your awesome work!
    Michael

  3. #13
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Oxygen and Basic syntax

    Charles,

    I think this is a great great addition and will burst Oxygen usage a lot.

    Thanks a lot
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #14

    Re: Oxygen and Basic syntax

    Right here goes!

    I think this will take about 2 months.

    Oxygen Basic Outline Specification



    DECLARATIVES type dim declare byval byref local static global

    _________________________________________________

    VARIABLE TYPES byte word dword qword long quad ext char wchar string (,,) pointer

    _________________________________________________

    OPERATORS + - * / \ ( ) = > < and or xor not ++ -- += -= *= /= and= or= xor= ptr * &
    _________________________________________________

    BLOCK STRUCTURES macro function sub gosub goto if then else elseif endif while wend do loop exit repeat select case

    _________________________________________________

    NUMERIC FUNCTIONS int round sin cos tan asin acos atan exp log val sqrt pi asc cvlong...

    _________________________________________________

    POINTER FUNCTIONS peek poke varptr strptr codeptr

    _________________________________________________

    STRING FUNCTIONS string$ trim$ mid$ str$ hex$ chr$() mklong$...

    _________________________________________________

    DIRECTIVES #ifdef #ifndef #endif #include basic(..) asm(..) o2(..)






  5. #15
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: Oxygen and Basic syntax

    Good move Charles,

    I will keep my fingers crossed for this, as it means big jump in usability for people normally afraid of assembler.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #16
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Oxygen and Basic syntax

    I am in deep water here, but I had an idea. I hope I can express the idea with the correct terms.

    Since thinBasic already exists, with syntax and parsing/tokenizing is done, perhaps you and Eros could work together and make a new directive that uses the current thinBasic parser/tokenizer and with the directive knows to then send the tokens to oxygen for doing its magic.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  7. #17

    Re: Oxygen and Basic syntax


    Hi Kent,

    Once the compiler logic is done, there are many possibillities, for instance passing function scripts to oxygen then, if they compile, calling them instead of interpreting. This could be done behind the scenes, without requiring an explicit directive.

    Another possibility is to assimilate the technology into thinCore so it can do its own JIT compiling on suitable script sections.

    Oxygen could also be used as a standalone compiler. - but what am I letting myself in for ?





  8. #18
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Oxygen and Basic syntax

    Reading your post it seems anything is possible Charles.

    It would be neat to see a test , maybe something like a loop benchmark that perhaps counts to some high number.
    Something easy to write, but to see what sort of improvements in speed one could see.

    First - thinBasic only.
    Second - Just In Time compiled
    Third - Stand alone compiled .exe

    About Just In Time compilation, why make it try to select sections to compile and not just compile everything just in time?



    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  9. #19
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Oxygen and Basic syntax

    Kent,

    executing interpret code and just in time compiling are 2 complete different things. We cannot mix each other.
    I would wait for Charles to come out with a solution and see. It will take some time (Charles said 2 months) because things are not so simple.

    As Charles showed, if we will have the possibility to define a BASIC like source code to pass to Oxygen and have back a pure machine code buffer to be linked to a DEFINE thinBasic function, WOW, it will be great! It will greatly improve execution speed by some factors because it would be like calling an external function from inside a DLL!

    To me Oxygen was already a dream with ASM like syntax but with BASIC like syntax it is a dream coming true!

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  10. #20

    Re: Oxygen and Basic syntax

    Quote Originally Posted by kent sarikaya

    About Just In Time compilation, why make it try to select sections to compile and not just compile everything just in time?
    I can envisage some dynamic things normally done in an interpreter might require compiling every time they are encountered - then interpreting would be more efficient and safer - for instance Eval(..). But JIT compiling certainly gives you more flexibility than static compiling.

    The other issue is the HUGE and ever growing instruction set of thinBasic and all its modules!

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Basic syntax c++ (almost)
    By jcfuller in forum Other languages
    Replies: 5
    Last Post: 08-05-2010, 11:31

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •