Results 1 to 10 of 10

Thread: Interpreter (computing)

  1. #1
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55

    Interpreter (computing)

    Hi,

    note: this is not a question about the difference between interpreter and compiler.

    according to wikipedia,
    An interpreter generally uses one of the following strategies for program execution:

    1. parse the source code and perform its behavior directly;
    2. translate source code into some efficient intermediate representation and immediately execute this;
    3. explicitly execute stored precompiled code[1] made by a compiler which is part of the interpreter system.
    • in which category do thinBasic fall ?
    • from a general point of view, what prevent an interpreter to generate a compiled executable ?
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  2. #2
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174
    Yes, I also always asked myself how it works.

    I came to the conclusion it must be some kind of magic that I will never ever understand and instead of wasting my time to think about how it works I will just accept that it works and use it.

    I think there are missing some Forum-sections as beta-testing and support

  3. #3
    My understanding is thinBasic executes text code statement by statement.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  4. #4
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55
    Quote Originally Posted by John Spikowski View Post
    My understanding is thinBasic executes text code statement by statement.
    I agree that's what's an interpreter. So if in the end some code is executed, there seems not much difference to put this code in cache memory for subsequent execution ?

    ReneMiner, you're an philosopher
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  5. #5
    I think the goal of a BASIC interpreter is to minimize the number of steps to its simplist form for any given task. If raw speed is what you're after, write an extension in a compiled language and call its functions.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  6. #6
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55
    Quote Originally Posted by John Spikowski View Post
    If raw speed is what you're after
    You didn't get it John. It's a general discussion: why developing an interpreter and stop there, not proposing a compiler along ?
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  7. #7
    I think you missed my point. It has nothing to do with compilers. It's about calling efficient libraries from your interpreter to gain speed.
    Last edited by John Spikowski; 18-11-2018 at 00:25.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  8. #8
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174
    Quote Originally Posted by DirectuX View Post
    ...why developing an interpreter and stop there, not proposing a compiler along ?
    To me it should be easy to replace, improve or just read the code.
    If compiled it would be a problem to me to study other users scripts as well as to use them as a skeleton that I could extend with own ideas and functions.
    If the interpreter itself runs at extraordinary speed and maintains a program with the advantages of a flexible, changeable code - why would I want to compile it?
    Imagine there's a typo in the UI or small bug to fix, or even you want to try to your needs changed parameters - if compiled you need the sources to do it yourself and probably also the compiler and additional time.

    Also your own scripts... you publish them, others read them and can see how you solved a problem. Next time another user writes a script and he will be faster because you did the thinking already and he learned from your solution - do not say copied!
    Or even the other way around: another user reads your published script and brings you to the idea to try to solve the problem another way and you learn.

    That's what I would call communication, exchange, growth.
    Interpreted, readable languages seems to me, are able to progress much faster in efficiency because the ones who are really interested can easily share ideas and discuss problems.
    The conditions for any language to be interesting enough, so people will try it out and use it, are that they are able to find working solutions for their own ideas by logic thinking, a good documentation and other users who can give advise or at least understand the problem = a living community.

    Compiled... kind of encrypted, unreadable... Hmm, maybe to finalize a project like to create an executable...
    If speed were the reason to compile a program then perhaps the programmer as first should check if he can improve his code to run faster without to compile it than to rely on the compiler.
    I think there are missing some Forum-sections as beta-testing and support

  9. #9
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55
    Quote Originally Posted by ReneMiner View Post
    why would I want to compile it?
    Quote Originally Posted by John Spikowski View Post
    to gain speed.






    Let me refocus the discussion...
    I am not looking for obfuscation. I am not looking for a speed solution.
    I hoped a kind discussion about software.

    Quote Originally Posted by DirectuX View Post
    • from a general point of view, what prevent an interpreter to generate a compiled executable ?
    Or maybe I was not sufficiently eloquent about my thoughts, but can't think of an another way to ask this. Below, I try to reformulate the question:
    From a general point of view, why languages that have an interpreter doesn't have a compiler as well, as, from my understanding so far, there is not a so big step from interpretation to compilation ?
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  10. #10
    One thing I like about Script BASIC is it runs as a shared object. (DLL, SO, ...) When running in a threaded model having your interpreter always resident in memory helps. SB also precompiles its code in a continuous memory binary format before execution. The script never starts and a error returned if the program is unrunnable.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

Similar Threads

  1. Interpreter
    By peter in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 4
    Last Post: 08-11-2012, 23:29
  2. CH Interpreter
    By zak in forum C / C++
    Replies: 5
    Last Post: 10-03-2012, 09:39
  3. Emotions, computing and artificial intelligence
    By LanceGary in forum Shout Box Area
    Replies: 0
    Last Post: 21-09-2010, 14:47
  4. Interactive interpreter
    By Mark0 in forum thinBasic General
    Replies: 7
    Last Post: 28-04-2008, 21:29
  5. New to interpreter type questions.
    By Steve in forum thinBasic General
    Replies: 7
    Last Post: 24-02-2008, 01:22

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

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