Author Topic: v1.5 128 bit (and beyond) math *** COMPILER ERROR ***  (Read 30198 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
Re: QB64 v1.5 Feature Request - interpreter options
« Reply #15 on: April 21, 2020, 05:35:30 am »
Looking back to others attempts to an interpreter...

Extract from dynamic HTML below:-

Quote



 

   
News:
Instructions for creating Android Apps:
http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=13162.0

Home
Help
Search
Login
Register

QB64 Community »
Programs (.BAS), Tutorials and Libraries ($INCLUDE, DECLARE LIBRARY, ...) »
Sample Programs (Moderators: Galleon, OlDosLover, SMcNeill, Kobolt) »
Return of the possibly useless interpreter

« previous next »
Print
Pages: [1]
 Author Topic: Return of the possibly useless interpreter  (Read 620 times)
rks
Newbie

Posts: 34

 
Return of the possibly useless interpreter
« on: December 07, 2015, 09:47:22 am »

This is an interpreter I've written based (very) loosely on ASM, I dust it off occasionally and tinker with it, this is one of those occasions.  I've also written an editor to go with it this time.  Unzip it all in a folder, compile the interpreter with or without the editor and have at it.  There are some demo scripts and a game.  It's something to kill time with when things are slow.

r


 sscript21.zip (39.36 kB - downloaded 63 times.)
« Last Edit: December 07, 2015, 02:08:59 pm by rks »
 Logged

FellippeHeitor
QB64 Partner Site Owner
Hero Member

 
Posts: 1806
LET IT = BE

 
Re: Return of the possibly useless interpreter
« Reply #1 on: December 07, 2015, 10:23:39 am »

Looks like it was a lot of work. Everything worked as expected here. Congrats!
« Last Edit: December 07, 2015, 10:34:36 am by FellippeHeitor »
 Logged
- InForm for QB64 http://qb64.org/inform

- vWATCH64 (debugger for QB64) http://bit.ly/vWATCH64v1-103

- Games: http://bit.ly/2048_qb64 * http://bit.ly/ClonedShades_qb64source * http://bit.ly/2aqK866 * http://bit.ly/SpaceshipQB64 * http://bit.ly/2rD1pPP

FellippeHeitor
QB64 Partner Site Owner
Hero Member

 
Posts: 1806
LET IT = BE

 
Re: Return of the possibly useless interpreter
« Reply #2 on: December 07, 2015, 10:30:15 am »

You may want to correct line 94 on the script for Nightfall; it seems like it should read:
Code: [Select]
$rndm 2,12
« Last Edit: December 07, 2015, 10:35:46 am by FellippeHeitor »
 Logged
- InForm for QB64 http://qb64.org/inform

- vWATCH64 (debugger for QB64) http://bit.ly/vWATCH64v1-103

- Games: http://bit.ly/2048_qb64 * http://bit.ly/ClonedShades_qb64source * http://bit.ly/2aqK866 * http://bit.ly/SpaceshipQB64 * http://bit.ly/2rD1pPP

rks
Newbie

Posts: 34

 
Re: Return of the possibly useless interpreter
« Reply #3 on: December 07, 2015, 01:14:07 pm »

You are correct, there are several $rdm's that should have been $rndm, that was a late change and I forgot about it.  Thanks. 

r

 Logged

rks
Newbie

Posts: 34

 
Re: Return of the possibly useless interpreter
« Reply #4 on: December 07, 2015, 01:34:35 pm »

I've posted a corrected .zip file.

 Logged

Print
Pages: [1]
« previous next »
QB64 Community »
Programs (.BAS), Tutorials and Libraries ($INCLUDE, DECLARE LIBRARY, ...) »
Sample Programs (Moderators: Galleon, OlDosLover, SMcNeill, Kobolt) »
Return of the possibly useless interpreter

 


SMF 2.0.3 | SMF © 2011, Simple Machines
XHTML
RSS
WAP2



I do not have the zip file - maybe a forum member does?

Offline CBTJD

  • Newbie
  • Posts: 60
  • You're only as old as you feel. ...I'm screwed.
Re: QB64 v1.5 Feature Request - interpreter options
« Reply #16 on: April 25, 2020, 12:49:42 pm »
Thinking of other possible features for 1.5, here is one.  How about having it automatically minimize the QB64 window when you run the program and then returns when you exit the program.

Something I thought of some may also like.  Just a thought.
OOh, I like it! Sounds like a good idea.
:@)
CBTJD: Coding BASIC Takes Judicious Dedication

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
Re: QB64 v1.5 Feature Request - interpreter options
« Reply #17 on: April 25, 2020, 01:00:27 pm »
I wouldn't use it, but I'd like it as an option, anyway. If I'm building a program, I like to leave the IDE on the desktop, just in case the program throws an error. Then I'd just click the SEARCH tag and pop in the line number. Can you believe in 40 years of programing, I've never had to do that? If so, I've got some left over Toilet Duck you can inject.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
Quiz Question:-


From the old [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] days what author-topic was most viewed (and approximately how many views).



The answer for the topic title does not have to exactly match and a tolerance of +/- 25% (maybe more) for the views given.

If a topic title eg "SDL" is given and this title (or very similar) has more than one author, then the post with the higher number of views is taken.

To allow time for a few replies, I plan to tell the answer say at the end of June (if there are any entries).

There is "no reward" for the most correct answer.

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
I have a suspicion it was Unseen's GDK post.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • Steve’s QB64 Archive Forum
Quiz Question:-


From the old [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] days what author-topic was most viewed (and approximately how many views).



The answer for the topic title does not have to exactly match and a tolerance of +/- 25% (maybe more) for the views given.

If a topic title eg "SDL" is given and this title (or very similar) has more than one author, then the post with the higher number of views is taken.

To allow time for a few replies, I plan to tell the answer say at the end of June (if there are any entries).

There is "no reward" for the most correct answer.

https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
lol, spoiler alert!
You're not done when it works, you're done when it's right.

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • Craz1000.net
The biggest reason i can think of for an interpreter being built in is you can have code in an external file that is in text form that can be modified without recompile. Sort of like the old Duke3D engine had all of its mechanics in a txt file containing the C code for all the weapons and enemies. It makes it easier to mod games or use a single sprite engine to make many different games without rewriting the engine and recompiling.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
For those interested in trying to make their own interpreter...



o14393-01
Author Topic: Novelty Interpreters (tiny)  (Read 667 times)




Quote


 
 

   
News:

Instructions for creating Android Apps:
http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=13162.0


Home
Help
Search
Login
Register

QB64 Community »
Programs (.BAS), Tutorials and Libraries ($INCLUDE, DECLARE LIBRARY, ...) »
Sample Programs (Moderators: Galleon, OlDosLover, SMcNeill, Kobolt) »
Novelty Interpreters (tiny)

« previous next »
Print
Pages: [1] 2
 Author Topic: Novelty Interpreters (tiny)  (Read 667 times)

bplus

Hero Member

 
Posts: 622
B = B + _

Novelty Interpreters (tiny)

« on: July 29, 2017, 09:23:57 am »
Hi all,

This subject was started by Aureal at the QB64.org with the BrainF*** (BF) Interpreter.

Well I have taken this tiny interpreter idea and ran with it. Now I CAN write a program for this IEN (but not BF!).

Maybe you will be as amused as I.

Here is what the Hi Lo Guessing Game looks like for IEN Interpreter. Most of the Cn's are just printing characters and so take up allot of room in the program.

Code: [Select]
P
Z100 M4 Z1 A0 F3
A4 B3 * M3
Z2 A0 B3 F3
Z1 A0 B3 + M3
[ C 69 C 110 C 116 C 101 C 114 C 32 C 97 C 32 C 103 C 117 C 101 C 115 C 115 C 32 C 102 C 111 C 114 C 32 C 109 C 121 C 32 C 110 C 117 C 109 C 98 C 101 C 114 C 32 C 98 C 101 C 116 C 119 C 101 C 101 C 110 C 32 C 49 C 32 C 97 C 110 C 100 C 32 C 49 C 48 C 48 C32 ?4
A4 B10 =
I
   X
N

A4 B3 >
I

   C 72 C 105 C 103 C 104 P
E
   <
   I
      C 76 C 111 C 119  P
   E
      C 82 C 105 C 103 C 104 C 116 C 33 P
      X
   N
N
P
]

This is full of tabs, spaces, line feeds to make it readable (well... easier) for humans. These are all stripped before the IEN Interpreter starts it's execution. IEN only works with one-liners ;-)) albeit they can be quite long!

Here is the current complete package for this ever evolving idea. My next thing will be string handling and comments.

Let me know what you think or ideas,

Mark

PS (Append): BTW, IEN stands for Is Everything Number? because that is all IEN can handle. To print text, you have to use the C command with the ASC number for the letter/digit/symbol. Letter by letter labels are displayed, yikes! (that part of things still not fun enough, YET!).
 Novelty IEN Interpreter.zip (1239.13 kB - downloaded 21 times.)
« Last Edit: July 31, 2017, 07:47:55 am by bplus »
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty IEN Interpreter

« Reply #1 on: July 29, 2017, 12:55:02 pm »
I better post the code so you don't worry it's too long. ;-))

Code: [Select]
'IEN Interpreter.bas for QB64 fork (B+=MGA) 2017-07-28 new name
RANDOMIZE TIMER
_TITLE "IEN Interpreter for QB64"

'for directory stuff
CONST ListMAX% = 20
COMMON SHARED dirList$()
COMMON SHARED DIRCount% 'returns file count if desired
DIM dirList$(ListMAX%)

CONST numChars$ = "-.1234567890"
CONST cmdChars$ = "WC?ABZMFIENP[X]%^/*~+=><()!&|"
CONST allChars$ = numChars$ + cmdChars$

CONST memsize% = 20000
COMMON SHARED memory#()
COMMON SHARED source$, code$, err$
DIM memory#(memsize%)

WHILE 1
    source$ = ""
    CLS
    ERASE dirList$
    DIM dirList$(ListMAX%)
    loadDirList "IEN*.txt"

    IF DIRCount% THEN
        FOR i% = 1 TO DIRCount%
            PRINT i%, dirList$(i%)
        NEXT
        PRINT: INPUT "Enter line number of IEN Filename you desire "; ln%
        IF ln% < 1 OR ln% > DIRCount% THEN END
        filename$ = dirList$(ln%)

        OPEN filename$ FOR INPUT AS #1
        DO
            LINE INPUT #1, FLINE$
            source$ = source$ + FLINE$
        LOOP UNTIL EOF(1)
        CLOSE #1

    ELSE
        PRINT "No IEN*.txt files found."
    END IF
    IF LEN(source$) THEN
        PRINT source$
        PRINT: INPUT "n(New)  e(Edit)  r(Run)  k(Kill)  q(Quits)  other(Files)"; menu$
    ELSE
        PRINT: INPUT "n(New) q(Quits)  other(Files)"; menu$
    END IF
    SELECT CASE UCASE$(LEFT$(menu$, 1))
        CASE "N": INPUT "Enter a title, for *IEN + title + DATE.TXT* format "; tl$
            dt$ = RIGHT$(DATE$, 4) + "-" + LEFT$(DATE$, 2) + "-" + MID$(DATE$, 4, 2)
            fname$ = "IEN " + tl$ + " " + dt$ + ".txt"
            OPEN fname$ FOR OUTPUT AS #1
            CLOSE #1
            SHELL "notepad " + fname$
        CASE "E": IF LEN(source$) THEN SHELL "notepad " + filename$
        CASE "K": IF LEN(source$) THEN KILL filename$
        CASE "Q": END
        CASE "R": IF LEN(source$) THEN CLS: runSource
    END SELECT
WEND

SUB runSource
source$ = UCASE$(source$)
'let's clean the code up, check bracket balance
bktCnt = 0: ifCnt = 0: code$ = ""
FOR i = 1 TO LEN(source$)
    char$ = MID$(source$, i, 1)
    'check to see if this is a valid instruction character
    IF INSTR(allChars$, char$) THEN
        code$ = code$ + char$
        'count brackets
        IF char$ = "[" THEN bktCnt = bktCnt + 1
        IF char$ = "]" THEN bktCnt = bktCnt - 1
        IF char$ = "I" THEN ifCnt = ifCnt + 1
        IF char$ = "N" THEN ifCnt = ifCnt - 1
    END IF
NEXT
IF bktCnt THEN 'mismatched brackets
    PRINT "Uneven brackets": SLEEP: EXIT SUB
ELSEIF ifCnt THEN
    PRINT "Uneven I N counts": SLEEP: EXIT SUB
ELSE
    PRINT code$ 'check
END IF
ERASE memory#
DIM memory#(memsize%)
cmd$ = "": ds$ = "": err$ = ""
FOR i% = 1 TO LEN(code$) 'loop through the code
    c$ = MID$(code$, i%, 1) 'get the instruction we're on
    IF INSTR("-.1234567890", c$) THEN ds$ = ds$ + c$
    IF INSTR(cmdChars$, c$) OR i% = LEN(code$) THEN 'hit next command or end
        IF cmd$ <> "" THEN 'execute unfinished command
            d# = VAL(ds$)
            'exec last cmd
            SELECT CASE cmd$
                CASE "A": memory#(1) = memory#(d#)
                CASE "B": memory#(2) = memory#(d#)
                CASE "Z": memory#(0) = d#
                CASE "M": memory#(d#) = memory#(0)
                CASE "F"
                    SELECT CASE memory#(1)
                        CASE 0: IF memory#(2) <> 0 THEN memory#(d) = 0 ELSE memory#(d) = 1
                        CASE 1: memory#(d#) = RND
                        CASE 2: memory#(d#) = INT(memory#(2))
                    END SELECT
                CASE "W": PRINT memory#(d#);
                CASE "C": PRINT CHR$(d#);
                CASE "?": INPUT memory#(d#)
            END SELECT
            cmd$ = "": ds$ = ""
        END IF 'if cmd <> ""

        'handle current cmd
        IF INSTR("WC?ABZMF", c$) THEN
            cmd$ = c$
        ELSEIF c$ = "I" THEN
            IF memory#(0) = 0 THEN i% = Findi(i%)
            IF err$ <> "" THEN PRINT err$: SLEEP: EXIT SUB
        ELSEIF c$ = "E" THEN
            i% = Findi(i%)
            IF err$ <> "" THEN PRINT err$: SLEEP: EXIT SUB
        ELSEIF c$ = "P" THEN
            PRINT
        ELSEIF c$ = "X" THEN
            bktCnt% = 1 'count the bracket we're on
            i% = i% + 1 'move the code pointer to the next char
            WHILE bktCnt% <> 0
                'count nested loops till we find the matching one
                IF MID$(code$, i%, 1) = "]" THEN bktCnt% = bktCnt% - 1
                IF MID$(code$, i%, 1) = "[" THEN bktCnt% = bktCnt% + 1
                i% = i% + 1 'search forward
            WEND
            i% = i% - 1%
        ELSEIF c$ = "]" THEN ' end a loop if loop index is 0
            bktCnt% = -1 'count the bracket we're on
            i% = i% - 1 'move the code pointer back a char
            WHILE bktCnt% <> 0
                'count nested loops till we fine the matching one
                IF MID$(code$, i%, 1) = "]" THEN bktCnt% = bktCnt% - 1
                IF MID$(code$, i%, 1) = "[" THEN bktCnt% = bktCnt% + 1
                i% = i% - 1 'search backwards
            WEND
            i% = i% + 1
        ELSEIF c$ = "%" THEN
            memory#(0) = memory#(1) MOD memory#(2)
        ELSEIF c$ = "^" THEN
            memory#(0) = memory#(1) ^ memory#(2)
        ELSEIF c$ = "/" THEN
            memory#(0) = memory#(1) / memory#(2)
        ELSEIF c$ = "*" THEN
            memory#(0) = memory#(1) * memory#(2)
        ELSEIF c$ = "~" THEN
            memory#(0) = memory#(1) - memory#(2)
        ELSEIF c$ = "+" THEN
            memory#(0) = memory#(1) + memory#(2)
        ELSEIF c$ = "=" THEN
            memory#(0) = memory#(1) = memory#(2)
        ELSEIF c$ = "<" THEN
            memory#(0) = memory#(1) < memory#(2)
        ELSEIF c$ = ">" THEN
            memory#(0) = memory#(1) > memory#(2)
        ELSEIF c$ = "(" THEN
            memory#(0) = memory#(1) <= memory#(2)
        ELSEIF c$ = ")" THEN
            memory#(0) = memory#(1) >= memory#(2)
        ELSEIF c$ = "!" THEN
            memory#(0) = memory#(1) <> memory#(2)
        ELSEIF c$ = "&" THEN
            IF memory#(1) <> 0 AND memory#(2) <> 0 THEN
                memory#(0) = -1
            ELSE
                memory#(0) = 0
            END IF
        ELSEIF c$ = "|" THEN
            IF memory#(1) <> 0 OR memory#(2) <> 0 THEN
                memory#(0) = -1
            ELSE
                memory#(0) = 0
            END IF
        END IF
    END IF ' ran into next command
NEXT
PRINT: INPUT "Run is done, enter to continue..."; temp$
END SUB

FUNCTION Findi% (i%)
cnt% = 1
FOR j% = i% + 1 TO LEN(code$)
    c1$ = MID$(code$, j%, 1)
    IF c1$ = "N" THEN
        cnt% = cnt% - 1
        IF cnt% = 0 THEN Findi% = j%: EXIT FUNCTION
    ELSEIF c1$ = "I" THEN
        cnt% = cnt% + 1
    ELSEIF c1$ = "E" AND cnt% = 1 THEN
        Findi% = j%: EXIT SUB
    END IF
NEXT
err$ = "Could not find N"
END FUNCTION

' modified function from Help files
SUB loadDirList (spec$)
CONST TmpFile$ = "DIR$INF0.INF"
IF spec$ > "" THEN 'get file names when a spec is given
    SHELL _HIDE "DIR " + spec$ + " /b > " + TmpFile$
    Index% = 0: dirList$(Index%) = "": ff% = FREEFILE
    OPEN TmpFile$ FOR APPEND AS #ff%
    size& = LOF(ff%)
    CLOSE #ff%
    IF size& = 0 THEN KILL TmpFile$: EXIT SUB
    OPEN TmpFile$ FOR INPUT AS #ff%
    DO WHILE NOT EOF(ff%) AND Index% < ListMAX%
        Index% = Index% + 1
        LINE INPUT #ff%, dirList$(Index%)
    LOOP
    DIRCount% = Index% 'SHARED variable can return the file count
    CLOSE #ff%
    KILL TmpFile$
ELSE IF Index% > 0 THEN Index% = Index% - 1 'no spec sends next file name
END IF
END SUB

 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty SHN Interpreter

« Reply #2 on: July 31, 2017, 07:45:51 am »
SHN (Strings Handled Now) Interpreter coming soon!

Just have to work out the translation to QB64, piece of cake, right?

Looks to be about the same amount of commands believe it or not!
Functions will look more realistic and it will be as easy as eating pie to add your own (built-in ones, I mean).

Stay tuned...
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
Ashish

Hero Member

 
Posts: 551
Eat.... Sleep.... CODE.... Repeat.....

Re: Novelty Interpreters (tiny)

« Reply #3 on: July 31, 2017, 09:04:50 am »
Nice work bplus! I like it!
 Logged
if (Me.Success) {Me.Improve();} else {Me.TryAgain();}

aKFrameWork - http://bit.ly/aKFrameWork
p5js.bas - http://bit.ly/p5jsbas
Menu System - http://bit.ly/guiMenuBar

OpenGL Demos - http://bit.ly/openGLdemos
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #4 on: August 01, 2017, 09:02:42 pm »
Strings Now Handled

Code: [Select]
'SNH Interpreter.bas for QB64 fork (B+=MGA) 2017-08-01 trans
RANDOMIZE TIMER
_TITLE "Strings Now Hamdled, the SNH Interpreter (tiny)"
SCREEN 12: COLOR 7, 0: CLS

'for directory stuff
CONST ListMAX% = 20
COMMON SHARED dirList$()
COMMON SHARED DIRCount% 'returns file count if desired
DIM dirList$(ListMAX%)

CONST numChars$ = "-.1234567890"
CONST cmdChars$ = "W?ABCDFMIENP[X]%^/*~+=><()!&|"
CONST allChars$ = numChars$ + cmdChars$

CONST memsize% = 20000
COMMON SHARED m$()
COMMON SHARED source$, code$, err$
DIM m$(memsize%)
NotBeenHere% = 1
'PRINT "COMMAND$ = "; COMMAND$
'INPUT "OK, press enter "; temp$
WHILE 1
    source$ = ""
    COLOR 7, 0: CLS
    ERASE dirList$
    DIM dirList$(ListMAX%)
    loadDirList "*SNH.txt"
    IF _FILEEXISTS(COMMAND$) AND RIGHT$(UCASE$(COMMAND$), 7) = "SNH.TXT" AND NotBeenHere% = 1 THEN
        filename$ = COMMAND$: NotBeenHere% = 0
    ELSEIF DIRCount% THEN
        FOR i% = 1 TO DIRCount%
            PRINT i%, dirList$(i%)
        NEXT
        PRINT: INPUT "0 quits, Enter line number of SNH Filename you desire "; ln%
        IF ln% < 1 OR ln% > DIRCount% THEN END
        filename$ = dirList$(ln%)
    ELSE
        PRINT "No *SNH.txt files found."
        SLEEP: END
    END IF
    OPEN filename$ FOR INPUT AS #1
    DO
        LINE INPUT #1, fline$
        source$ = source$ + fline$
        'PRINT fline$
        'INPUT " OK, enter"; temp$
    LOOP UNTIL EOF(1)
    CLOSE #1
    runSource
WEND

SUB runSource
    ERASE m$
    DIM m$(memsize%)
    'note: anything above first {} is comment and ignored
    'First get m$ (string memory array) loaded with data values
    FOR i% = 1 TO LEN(source$)
        c$ = MID$(source$, i%, 1)
        IF c$ = "{" THEN
            bs% = i%
            WHILE MID$(source$, i%, 1) <> "}"
                i% = i% + 1
                IF i% = LEN(source$) THEN PRINT "Missing }": SLEEP: EXIT SUB
            WEND
            ix% = VAL(MID$(source$, bs% + 1, i% - bs% - 1))
            IF ix% < 1 THEN EXIT FOR
            b$ = "": i% = i% + 1
            WHILE MID$(source$, i%, 1) <> ";"
                b$ = b$ + MID$(source$, i%, 1)
                i% = i% + 1
                IF i% = LEN(source$) THEN PRINT "Missing ending ;": SLEEP: EXIT SUB
            WEND
            m$(ix%) = b$
        END IF
    NEXT
    source$ = MID$(source$, i% + 1)

    'OK now letters, digits or symbols from strings wont interfere with program code
    source$ = UCASE$(source$)
    'let's clean the code up, check bracket balance
    bktCnt% = 0: ifCnt% = 0: code$ = ""
    FOR i = 1 TO LEN(source$)
        char$ = MID$(source$, i, 1)
        'check to see if this is a valid instruction character
        IF INSTR(allChars$, char$) THEN
            code$ = code$ + char$
            'count brackets
            IF char$ = "[" THEN bktCnt% = bktCnt% + 1
            IF char$ = "]" THEN bktCnt% = bktCnt% - 1
            IF char$ = "I" THEN ifCnt% = ifCnt% + 1
            IF char$ = "N" THEN ifCnt% = ifCnt% - 1
        END IF
    NEXT
    PRINT "Code check: "; code$
    IF bktCnt% THEN 'mismatched brackets
        PRINT "Uneven brackets": SLEEP: EXIT SUB
    ELSEIF ifCnt% THEN
        PRINT "Uneven I N counts": SLEEP: EXIT SUB
    ELSE
        PRINT code$ 'check
        INPUT "OK, press enter... "; temp$
        CLS
    END IF

    cmd$ = "": ds$ = "": err$ = ""
    FOR i% = 1 TO LEN(code$) 'loop through the code
        c$ = MID$(code$, i%, 1) 'get the instruction we're on
        IF INSTR("-.1234567890", c$) THEN ds$ = ds$ + c$
        IF INSTR(cmdChars$, c$) OR i% = LEN(code$) THEN 'hit next command or end
            IF cmd$ <> "" THEN 'execute unfinished command
                d# = VAL(ds$)
                'exec last cmd
                SELECT CASE cmd$
                    CASE "A": m$(1) = m$(d#)
                    CASE "B": m$(2) = m$(d#)
                    CASE "C": m$(3) = m$(d#)
                    CASE "D": m$(4) = m$(d#)
                    CASE "F"
                        SELECT CASE m$(1) 'the function name m$(2) 1st para...
                            CASE "NOT": IF VAL(m$(2)) = 0 THEN m$(d#) = "-1" ELSE m$(d#) = "0"
                            CASE "RND": m$(d#) = STR$(RND)
                            CASE "INT": m$(d#) = STR$(INT(VAL(m$(2))))
                            CASE "CTR": LOCATE CSRLIN, (80 - LEN(m$(2))) / 2: PRINT m$(2);
                            CASE "CLS": CLS
                            CASE "COLOR": COLOR VAL(m$(2)), VAL(m$(3))
                            CASE "LEN": m$(d#) = STR$(LEN(m$(2)))
                            CASE "MID1": m$(d#) = MID$(m$(2), VAL(m$(3)))
                            CASE "MID2": m$(d#) = MID$(m$(2), VAL(m$(3)), VAL(m$(4)))
                            CASE "INSTR1": m$(d#) = STR$(INSTR(m$(2), m$(3)))
                            CASE "INSTR2": m$(d#) = STR$(INSTR(VAL(m$(2)), m$(3), m$(4)))
                            CASE "LOCATE": LOCATE VAL(m$(2)), VAL(m$(3))
                        END SELECT
                    CASE "M": m$(d#) = m$(0)
                    CASE "W": PRINT m$(d#);
                    CASE "?": INPUT m$(d#)
                END SELECT
                cmd$ = "": ds$ = ""
            END IF 'if cmd <> ""

            'handle current cmd
            IF INSTR("ABCDFMW?", c$) THEN
                cmd$ = c$
            ELSEIF c$ = "I" THEN
                IF VAL(m$(0)) = 0 THEN i% = Findi(i%)
                IF err$ <> "" THEN PRINT err$: SLEEP: EXIT SUB
            ELSEIF c$ = "E" THEN
                i% = Findi(i%)
                IF err$ <> "" THEN PRINT err$: SLEEP: EXIT SUB
            ELSEIF c$ = "P" THEN
                PRINT
            ELSEIF c$ = "X" THEN
                bktCnt% = 1 'count the bracket we're on
                i% = i% + 1 'move the code pointer to the next char
                WHILE bktCnt% <> 0
                    'count nested loops till we find the matching one
                    IF MID$(code$, i%, 1) = "]" THEN bktCnt% = bktCnt% - 1
                    IF MID$(code$, i%, 1) = "[" THEN bktCnt% = bktCnt% + 1
                    i% = i% + 1 'search forward
                WEND
                i% = i% - 1%
            ELSEIF c$ = "]" THEN ' end a loop if loop index is 0
                bktCnt% = -1 'count the bracket we're on
                i% = i% - 1 'move the code pointer back a char
                WHILE bktCnt% <> 0
                    'count nested loops till we fine the matching one
                    IF MID$(code$, i%, 1) = "]" THEN bktCnt% = bktCnt% - 1
                    IF MID$(code$, i%, 1) = "[" THEN bktCnt% = bktCnt% + 1
                    i% = i% - 1 'search backwards
                WEND
                i% = i% + 1
            ELSEIF c$ = "%" THEN: m$(0) = STR$(VAL(m$(1)) MOD VAL(m$(2)))
            ELSEIF c$ = "^" THEN: m$(0) = STR$(VAL(m$(1)) ^ VAL(m$(2)))
            ELSEIF c$ = "/" THEN: m$(0) = STR$(VAL(m$(1)) / VAL(m$(2)))
            ELSEIF c$ = "*" THEN: m$(0) = STR$(VAL(m$(1)) * VAL(m$(2)))
            ELSEIF c$ = "~" THEN: m$(0) = STR$(VAL(m$(1)) - VAL(m$(2)))
            ELSEIF c$ = "+" THEN: m$(0) = STR$(VAL(m$(1)) + VAL(m$(2)))
            ELSEIF c$ = "=" THEN: m$(0) = STR$(VAL(m$(1)) = VAL(m$(2)))
            ELSEIF c$ = "<" THEN: m$(0) = STR$(VAL(m$(1)) < VAL(m$(2)))
            ELSEIF c$ = ">" THEN: m$(0) = STR$(VAL(m$(1)) > VAL(m$(2)))
            ELSEIF c$ = "(" THEN: m$(0) = STR$(VAL(m$(1)) <= VAL(m$(2)))
            ELSEIF c$ = ")" THEN: m$(0) = STR$(VAL(m$(1)) >= VAL(m$(2)))
            ELSEIF c$ = "!" THEN: m$(0) = STR$(VAL(m$(1)) <> VAL(m$(2)))
            ELSEIF c$ = "&" THEN
                IF VAL(m$(1)) <> 0 AND VAL(m$(2)) <> 0 THEN m$(0) = "-1" ELSE m$(0) = "0"
            ELSEIF c$ = "|" THEN
                IF VAL(m$(1)) <> 0 OR VAL(m$(2)) <> 0 THEN m$(0) = "-1" ELSE m$(0) = "0"
            END IF ' ran into next command
        END IF
    NEXT
    PRINT: INPUT "Run is done, enter to continue..."; temp$
END SUB

FUNCTION Findi% (i%)
    cnt% = 1
    FOR j% = i% + 1 TO LEN(code$)
        c1$ = MID$(code$, j%, 1)
        IF c1$ = "N" THEN
            cnt% = cnt% - 1
            IF cnt% = 0 THEN Findi% = j%: EXIT FUNCTION
        ELSEIF c1$ = "I" THEN
            cnt% = cnt% + 1
        ELSEIF c1$ = "E" AND cnt% = 1 THEN
            Findi% = j%: EXIT SUB
        END IF
    NEXT
    err$ = "Could not find N"
END FUNCTION

' modified function from Help files
SUB loadDirList (spec$)
    CONST TmpFile$ = "DIR$INF0.INF"
    IF spec$ > "" THEN 'get file names when a spec is given
        SHELL _HIDE "DIR " + spec$ + " /b > " + TmpFile$
        Index% = 0: dirList$(Index%) = "": ff% = FREEFILE
        OPEN TmpFile$ FOR APPEND AS #ff%
        size& = LOF(ff%)
        CLOSE #ff%
        IF size& = 0 THEN KILL TmpFile$: EXIT SUB
        OPEN TmpFile$ FOR INPUT AS #ff%
        DO WHILE NOT EOF(ff%) AND Index% < ListMAX%
            Index% = Index% + 1
            LINE INPUT #ff%, dirList$(Index%)
        LOOP
        DIRCount% = Index% 'SHARED variable can return the file count
        CLOSE #ff%
        KILL TmpFile$
    ELSE IF Index% > 0 THEN Index% = Index% - 1 'no spec sends next file name
    END IF
END SUB

I threw out the file management stuff, let the Windows Explorer or Equivalent do that stuff!

Now you can drag and drop *SNH.txt programs onto the exe or select a file to run from a folder listing.

A limited set of built-in functions just to show that they All can be done.

EDIT: 2017-08-02 12:18 PM    It turns out that the NOT function did need to be fixed, -1 not 1 for True.
That and some additional *SNH.txt code files have been added to the revised SNH Pack.zip

 SNH Pack.zip (635.14 kB - downloaded 16 times.)
« Last Edit: August 02, 2017, 09:25:17 am by bplus »
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #5 on: August 02, 2017, 09:24:14 am »
Small fix made to .bas & .exe code in the SNH Pack.zip attachment in previous post.

Additional test *SNH.txt files have been added and some more edits of the Read Me.txt file.

 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #6 on: February 08, 2018, 02:31:17 pm »
I have converted SmallBASIC Nano3 Interpreter to QB64 with help with Evaluate system started in JB, further developed in FB and then converted to QB64.

The Interpreter now works completely as a stand alone 6 times the size Nano was.

It is a drag and drop of source code program onto BRUN.exe. All the file management stuff is left to Windows or your OS and all editing left to NotePad++ or your favorite editor.

The BRUN Pack#1.zip has a bonus copy of source code and exe with debugger switched on so can step through each line of program and watch the variables to help track down errors.

Also included in package are 10 sample and test programs and one 000BRUN Help B.txt cheat sheet of 21 keywords and list of math functions...

New form Nano3 is variable names as long as you like, setting number variables are done with n keyword at first position in program line instead of = sign after variable name.

It might be fun to play with for short programs...

attached is zip and a few screen shots: cheat sheet and 2 calculator programs

Next up, I have to remember how to handle strings and their functions... (consulting last post here!),

I might have to give up on idea of no punctuation.

Append: Comment lines are ANY line that doesn't start with keyword, no REM or ' needed!
Printing stuff: just start line with . , or ;   no quotes needed, variable values are automatically substituted in for variable names.
You might miss having control of spaces (not ready yet) but have LOCATE sub replaced with: rc row, col and have graphics: at x, y to locate a print at any pixel.

Oh! Here is what code looks like for first calculator (to sort of look like the device, though you cant click keys (yet!))
Code: [Select]
calculator B.txt revised again for BRUN 2018-02-07 originally from:
calculator nano3.txt for Nano3.bas (B+=MGA) 2017-06-10

sub Menu
   n i -1
   at 0 80 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>__ r __<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
   at 0 120 Command Menu:
   do
      n i i + 1
      if i > 22
         exit
      fi
      n x (i % 5) * 160
      n y int( i / 5) * 50 + 160
   
      if i = 0
         at x y i = +
      fi
      if i = 1
         at x y i = -
      fi
      if i = 2
         at x y i = *
      fi
      if i = 3
         at x y i = /
      fi
      if i = 4
         at x y i = ^
      fi
      if i = 5
         at x y i = pi
      fi
      if i = 6
         at x y i = rad
      fi
      if i = 7
         at x y i = cos
      fi
      if i = 8
         at x y i = sin
      fi
      if i = 9
         at x y i = tan
      fi
      if i = 10
         at x y i = atan
      fi
      if i = 11
         at x y i = deg
      fi
      if i = 12
         at x y i = mod
      fi
      if i = 13
         at x y i = ln
      fi
      if i = 14
         at x y i = exp
      fi
      if i = 15
         at x y i = mIn
      fi
      if i = 16
         at x y i = m+
      fi
      if i = 17
         at x y i = mOut
      fi
      if i = 18
         at x y i = mClear
      fi
      if i = 19
         at x y i = # start
      fi
      if i = 20
         at x y i = quit
      fi
   loop
return

sub getC
   mark cStart
   cls
   gosub Menu
   at 0 40 Enter command number
   ? c
   if c >= 0
      if c < 23
         go cEnd
      else
         go cStart
      fi
   else
      go cStart
   fi
   mark cEnd
return

cls
at 0, 20 Enter a number for starting the calculator...
? r

do
   gosub getC
   
   if c = 0
      ? s + Enter number to add...
      n r r + s
   fi
   if c = 1
      ? s - Enter number to subtract...
      n r r  - s
   fi
   if c = 2
      ? s * Enter number to multiply...
      n r r * s
   fi
   if c = 3
      ? s / Enter divisor...
      if s <> 0
         n r r / s
      else
         . Oops, can't divide by 0
      fi
   fi
   if c = 4
      ? s ^ Enter power...
      n r r ^ s
   fi
   if c = 5
      n r pi
   fi
   if c = 6
      n r r *pi/180
   fi
   if c = 7
      n r cos( r )
   fi
   if c = 8
      n r sin( r )
   fi
   if c = 9
      n r tan( r )
   fi

   if c = 10
      n r atan( r )
   fi
   if c = 11
      n r deg( r )
   fi
   if c = 12
      ? s Enter modulus...
      n r r % s
   fi
   if c = 13
      n r log( r )
   fi
   if c = 14
      n r exp( r )
   fi
   if c = 15
      n m r
   fi
   if c = 16
      n m m + r
   fi
   if c = 17
      n r m
   fi
   if c = 18
      n m 0
   fi
   if c = 19
      ? r Enter new start number...
   fi
   if c = 20
      at 0 400 Goodbye!
      end
   fi
loop


And code for line calculator (or expressions evaluator):
Code: [Select]
Line calc by bplus for BRUN 2018-02-07
do
   at 110 40 *** Line Calculator ***
   at 10 80 arith: +, -, *, /,   constants: e, pi, random 0-1 use rnd
   at 10 100 (keep - for subtraction spaced on both sides to distinguish from neg numbers)
   at 10 120 functions modulus use %, power use ^, log, exp, sqr, int, random 0 to 1 use rnd
   at 10 140 trig (radians): sin( ), cos( ), tan( ), atan( ) conversion: rad, deg
   at 10 160 boolean: =, <>, <, <=, >, >=, and, or, not
   at 50 180 (results are displayed for 3.5 secs)
   n row int(220/16 + .5)
   rc row 2
   ? string (-42 to quit) Enter an expression to evaluate...
   if string = -42
      exit
   fi
   n result string
   at 10 250 The calculator came up with this: result
   wait 3.5
   cls
loop
cls
.
. Goodbye!
.
.
 BRUN pack #1.zip (914.47 kB - downloaded 7 times.)
 000 BRUN Help B_txt.PNG (43.7 kB - downloaded 4 times.)
 calculator B_txt.PNG (9.19 kB - downloaded 5 times.)
 line calc B_txt.PNG (14.01 kB - downloaded 4 times.)
« Last Edit: February 08, 2018, 02:56:27 pm by bplus »
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
IGetGroovy

Newbie

Posts: 23

Re: Novelty Interpreters (tiny)

« Reply #7 on: February 08, 2018, 08:15:15 pm »
I had a blast running the examples here bplus, nice job! This is a really cool project - this is the program that grew from the 100 LOC contest, right? I also messed with the line of code that reports on "EvalW" on each iteration and then re-ran everything - it's fun watching a recursive thing clamp down on an answer, agree? I also wonder if you know where this program is going next. In the spirit of separating mechanism from policy, do you intend on having a version that runs embedded in a terminal?

Now is another good chance to mention (perhaps not for the first time), do you have any aversion to hanging out in IRC #qb64? You are a vibrant member in the QB-sphere and I suspect you'd have a blast there.

 Logged
eoredson

Hero Member

 
Posts: 570
I programmed myself into a conniption..


Re: Novelty Interpreters (tiny)

« Reply #8 on: February 08, 2018, 11:08:53 pm »
I wrote an interpreter here:

http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?action=dlattach;topic=13148.0;attach=4378

Erik.
 Logged
Games: DNDDOOR - https://bit.ly/EriksDNDDoor DUNGEON - https://bit.ly/EriksDungeon
Interpreter - https://bit.ly/EriksSICK Hex Editor - https://bit.ly/EriksHexEditor
Utilities - https://bit.ly/EriksUtils Old QB64 - https://bit.ly/OldQB64
QB64 shell - https://bit.ly/QB64shell
FellippeHeitor

QB64 Partner Site Owner
Hero Member

 
Posts: 1806
LET IT = BE


Re: Novelty Interpreters (tiny)

« Reply #9 on: February 09, 2018, 05:35:52 am »
Is it interpreter sharing season? Here's mine too https://github.com/FellippeHeitor/QB64-interpreter

I'll check yours right now bplus, sounds like fun.
 Logged
- InForm for QB64 http://qb64.org/inform

- vWATCH64 (debugger for QB64) http://bit.ly/vWATCH64v1-103

- Games: http://bit.ly/2048_qb64 * http://bit.ly/ClonedShades_qb64source * http://bit.ly/2aqK866 * http://bit.ly/SpaceshipQB64 * http://bit.ly/2rD1pPP
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #10 on: February 09, 2018, 11:28:43 am »
Oh hey a response! Yeah!

Hi IGetGroovy,

Thanks for paying attention, yes it is Nano3 SmallBASIC code spread out into QB64 (version 2017 11 06 /82 (if I recall), sorry I forgot to add that Jack). Now I think I remember you from another name but which Luke? Bill? I can't keep track of names very well or do I mean psuedo names. Now I know where WHN? got the idea of constantly changing avatar names (and from lurking at Studio 54    ) are you all really one guy? maybe with split personality? Pete is that you!

There is talking, there is talking about coding and there is coding, I have no aversion to hanging out at IRC QB64, I do wish I could lurk a little before signing on as member, a glance into what I may be spending more time

Quote
In the spirit of separating mechanism from policy, do you intend on having a version that runs embedded in a terminal?
Plans? well embedding is not even on my radar but I asked a question about embedding at BP.org, 2 years before it went belly up, and have yet to get a decent answer: What is it? What is it good for? I've looked into it, a little, have some foggy notions but nothing is clear.

I have immediate plans for primitive graphics (got to have fun with that! specially if QB64 gives me more speed that SB) and of course strings and arrays. My plans are in To do list in opening comments of BRUN source... Long range? I usually go where the spirit takes me or am sorry I didn't.

This not BASIC, I don't want to build another BASIC interpreter, Erik and Fellippe's are likely too good to even try and better them ! It is Basic like, I guess since Basic is all I prefer to code with.

Yes! Fellippe and Erik, I have looked into both your beautiful monsters!  I suppose mine too is growing so large as to require serious study time to understand and use effectively.

BRUN (and Nano)  is very much in spirit of WHN? author of FIG, who started contest with Walter at TJP that ended up producing nascent Nano after nasty argument with him. I argue but I listen too (sometimes, specially when I respect person with whom I am arguing. Of course my idea of respect is to try and avoid foul moronic language, of course that does signal extreme frustration which is better than nothing, I guess.)

eh! I could go on and on about my child... sheeze
« Last Edit: February 09, 2018, 11:53:38 am by bplus »
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #11 on: February 09, 2018, 11:35:37 am »
Quote
Is it interpreter sharing season? Here's mine too https://github.com/FellippeHeitor/QB64-interpreter

I'll check yours right now bplus, sounds like fun.

Oh now I've seen Erik's post and understand 

Yes, Interpreter season opened up in January or before at TJP with David Taylor making all sorts of announcements with such piss and vinegar and spunk, it reignited my own spark for the subject.

The crazy thing is he is not sharing his source code, so I guess we are showing him how it's done.
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
eoredson

Hero Member

 
Posts: 570
I programmed myself into a conniption..


Re: Novelty Interpreters (tiny)

« Reply #12 on: February 09, 2018, 07:14:44 pm »
@bplus: You need to concentrate on your engine of choice first - such as a descent parser, then write the interpreter around it.

Pay certain attention on how to parse parenthesis first, then smaller structures like Do..Loop and For..Next.

Once the parser engine is written the rest will follow, including the basic commands - List, Run, Load, Save, etc.

Expect to spend alot of time on it.

Erik.
 Logged
Games: DNDDOOR - https://bit.ly/EriksDNDDoor DUNGEON - https://bit.ly/EriksDungeon
Interpreter - https://bit.ly/EriksSICK Hex Editor - https://bit.ly/EriksHexEditor
Utilities - https://bit.ly/EriksUtils Old QB64 - https://bit.ly/OldQB64
QB64 shell - https://bit.ly/QB64shell
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #13 on: February 09, 2018, 07:17:30 pm »
Quote from: eoredson on February 09, 2018, 07:14:44 pm
@bplus: You need to concentrate on your engine of choice first - such as a descent parser, then write the interpreter around it.

Pay certain attention on how to parse parenthesis first, then smaller structures like Do..Loop and For..Next.

Once the parser engine is written the rest will follow, including the basic commands - List, Run, Load, Save, etc.

Expect to spend alot of time on it.

Erik.

Been there done all that, did you even run a sample? just drag and drop a *B.txt file over BRUN.exe

You know this like my 6th (toy) interpreter ? and this is not traditional Basic IDE style runs.

Don't need List, Run, Load, Save ... as explained earlier, you edit your files in your favorite text editor (eliminates New, Load, List, Save, Edit), I am letting Windows or your favorite OS handle all file management (rename, cut/copy/paste to whatever folders, delete...). just end your program files with "B.txt"

The "engine" for parsing... handling expressions has been assembled and tutored at TJP under FreeBasic two threads on subject Evaluation. It does not use traditional parser techniques let alone worry about ascent and decent... yet it handles operators in regular order: preparing string for evaluation, substitutions in of constants and variable values, functions, math operators like mod and power, arith operators / then * the - then +, then booeans < = > stuff then logical conjugates "and" and "or" and finally not. True it's not the quickest most efficient system but it works.

You Run your source file, "Program name B.txt" by drag and drop onto the BRUN.exe and just like magic it runs or tells you the first line number it can't execute.

or drag and drop onto BRUN w debugger.exe and watch your code get processed line by line.

Here is a program "Count to ten B.txt"
Code: [Select]
n count 1
do
   . count
   n count count + 1
   if count > 10
       exit
   fi
loop
 count to 10.PNG (61.05 kB - downloaded 6 times.)
« Last Edit: February 09, 2018, 07:49:15 pm by bplus »
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
eoredson

Hero Member

 
Posts: 570
I programmed myself into a conniption..


Re: Novelty Interpreters (tiny)

« Reply #14 on: February 09, 2018, 07:20:13 pm »
Ok, well, if you've done all that, then, nevermind
 Logged
Games: DNDDOOR - https://bit.ly/EriksDNDDoor DUNGEON - https://bit.ly/EriksDungeon
Interpreter - https://bit.ly/EriksSICK Hex Editor - https://bit.ly/EriksHexEditor
Utilities - https://bit.ly/EriksUtils Old QB64 - https://bit.ly/OldQB64
QB64 shell - https://bit.ly/QB64shell
Print
Pages: [1] 2
« previous next »
QB64 Community »
Programs (.BAS), Tutorials and Libraries ($INCLUDE, DECLARE LIBRARY, ...) »
Sample Programs (Moderators: Galleon, OlDosLover, SMcNeill, Kobolt) »
Novelty Interpreters (tiny)
 


SMF 2.0.3 | SMF © 2011, Simple Machines
XHTML
RSS
WAP2




o14393-02
 
Quote


   
News:

Instructions for creating Android Apps:
http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=13162.0


Home
Help
Search
Login
Register

QB64 Community »
Programs (.BAS), Tutorials and Libraries ($INCLUDE, DECLARE LIBRARY, ...) »
Sample Programs (Moderators: Galleon, OlDosLover, SMcNeill, Kobolt) »
Novelty Interpreters (tiny)

« previous next »
Print
Pages: 1 [2]
 Author Topic: Novelty Interpreters (tiny)  (Read 667 times)

rks

Newbie

Posts: 34

Re: Novelty Interpreters (tiny)

« Reply #15 on: February 10, 2018, 09:35:13 am »
I'll throw mine back in again, I've done some more work on it, and it's probably to big to be considered a 'tiny' anything but it is a novelty something.

r
 tascript 30.7z (46.4 kB - downloaded 12 times.)
 Logged
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #16 on: February 10, 2018, 10:13:11 am »
Hi rks,

Thanks I will check it out, do you have a link here where/when you've discussed what you are doing?

I see you signed up 2012 (edit year) and are already up to 30 posts! I will check out those too, maybe you are Bill.


Append: Man what a salesman you are! Got me interested hook, line and slinker!
http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=13259.msg114533#msg114533
« Last Edit: February 10, 2018, 01:56:07 pm by bplus »
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
rks

Newbie

Posts: 34

Re: Novelty Interpreters (tiny)

« Reply #17 on: February 11, 2018, 09:21:21 am »
Hi bplus,

Back when I posted the first version of the interpreter (several years ago under a different name), there was some explanation, but it was so long ago I can't remember it, which is not unusual. There is a piece in the manual about what I’m doing but honestly it came about from two reasons, a desire to write my own language without actually having a clue as to how to go about it, and sufficient boredom one winter to make me start.  So I read a few articles, some of which I almost understood and with no plan in sight started coding a way to get single keystrokes followed by a way to print them.  I’ve used syntax from several different languages and made up the rest as I went, through several iterations, to reach this point.  I’m probably done with it for a while, it’s ended up a lot bigger than I intended as it strayed from it’s original purpose of a text game engine into a more general purpose language, but it’s been an interesting diversion.
And by the way, I'm not Bill, at least that I recall.

r
 Logged
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #18 on: February 11, 2018, 11:56:58 am »
Hi rks,

Nice docs, 8 pages is about my limit but you seem to be doing things well = how I might! ha!

I like how you map all the jump points line labels, go subs... and how you fit your IF lines to that system.

I also like how it is designed, at least originally, with a particular goal of being a text game engine. That gives one a clear idea of direction and when one is done or when one might add a new feature...

Doing a general interpreter covers too broad an area specially if one of your ideas/ideals is that the smaller the more fun to learn and use.
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
rks

Newbie

Posts: 34

Re: Novelty Interpreters (tiny)

« Reply #19 on: February 12, 2018, 09:23:18 am »
Thanks!  The docs came into being after I forgot how I was implementing something after a several day break, figured if I didn't write things down I never know where I was.  The general purposity (? new word alert!) came about from playing with ways to modify text and it's easy enough to ignore them when they aren't needed.  It doesn't hurt that the compiled size doesn't change much with or without the feature bloat, but it's sometimes difficult to keep ones fingers out of the pie.  Anyway, the layout makes things fairly simple to strip out non-essentials if needed.
I've been reading through your latest, nice!  Although BRUN brought back memories of good ole QB run times.

r
 Logged
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #20 on: February 12, 2018, 09:40:25 am »
Code: [Select]
Although BRUN brought back memories of good ole QB run times.
Yes, I am glad you caught that!

I hope my effort is respectful and honoring of that tradition. If not please complain and I will change name (alas poor Erik, another name to track!)

I tried some research on BRUN name, came up with zilch, no mention of QuickBasic or QBasic (and I am still trying to figure out the original name of QB version name I was using, I think QuickBasic 4.5 because it did have compiler and it was just before QBasic came free with DOS (I just learned it was DOS 5 not 6 that QBasic came free without compiler).
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
rks

Newbie

Posts: 34

Re: Novelty Interpreters (tiny)

« Reply #21 on: February 13, 2018, 09:33:54 am »
I like the name, brings back memories.  BRUN had the version number of QB as part of the name, so QB45 came with BRUN45.EXE, QB40 came with BRUN40.EXE, etc.  It also seems like QB45 was little more than an IDE update to QB40.  It was something of a shock when I upgraded from DOS 4.01 to DOS 5.0 and had QBasic instead of BASICA, that took some getting used to.
Anyway, I like the conciseness of your language, mine sprawls all over the place.

r
 Logged
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #22 on: February 13, 2018, 10:56:30 am »
Hi rks,

Speaking of likes, I forgot to mention I like [varaiable] to tell exe to print value instead of string (or name of variable).

I like it so much I might have to steal idea.   (if paying this compliment isn't enough).


Re: Arrays and strings

Last night I woke up at 4 AM with idea that might eliminate need for strings and arrays (as we QBers know them anyway).

I did say, might, these middle of night insights sometimes do pan out but not exactly how they were first seen...

Anyway I hope I have titillated and stirred up some imaginations with this announcement.
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #23 on: February 14, 2018, 01:08:27 am »
Hey happy Valentines Day!

Code: [Select]
simple sieve 2 B.txt for BRUN v 2 2018-02-14 adopted from:
'Simple sieve 2.bas SmallBASIC 2015-04-29 found a faster sieve with BASIC 256
n topLimit 100
n limit topLimit ^ .5
. Primes to topLimit
take care of even numbers first
n index 4
do
   put composites index 1
   n index index + 2
   if index > topLimit
      exit
   fi
loop
now do odd numbers
n index 3
do
   get test composites index
   if test = 0
      if index < limit
         n j 2 * index
         do
            put composites j 1
            n j j + index
            if j > topLimit
               exit
            fi
         loop
      fi
   fi
   n index index + 2
   if index > limit
      exit
   fi
loop
n index 2
pCount = 0
do
   get test composites index
   if test = 0
      n pCount pCount + 1
      . index
   fi   
   n index index +1
   if index > topLimit
      exit
   fi
loop
.
. There are pCount primes for the first topLimit integers.


It works!
 prime sieve 2.PNG (11.13 kB - downloaded 4 times.)
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #24 on: February 14, 2018, 07:02:34 am »
Glacial slow get and put for BRUN 2

Basic: array(Index) = someValueEvaluatedInProgramLine
BRUN 2  put syntax:
put stringArrayName numberVariableIndex valueFromNumberCalcInProgramLine

Basic: numberVariable = array(Index)
BRUN 2  get syntax:
get getValuePutUnderThisNumberVariableName fromThisStringArrayVariableName andThisNumberVariableIndex
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
rks

Newbie

Posts: 34

Re: Novelty Interpreters (tiny)

« Reply #25 on: February 14, 2018, 09:14:33 am »
You are more than welcome to use [variable], I took it from assembly language.

Without strings and arrays what would the BASIC community have to argue about making the best use of?  Does sound intriguing, though.  I've had some of those middle of the night flashes of insight, mine rarely make nearly as much sense after coffee.

There's nothing wrong with glacially slow if you get the correct answer, speed can be worked on later.

r
 Logged
bplus

Hero Member

 
Posts: 622
B = B + _

Re: Novelty Interpreters (tiny)

« Reply #26 on: February 14, 2018, 10:01:34 am »
  so that's why I drink so much coffee! to sober up from my dreams...
 Logged
Will you still love me, will you still need me, when I'm (QB) 64?
eoredson

Hero Member

 
Posts: 570
I programmed myself into a conniption..


Re: Novelty Interpreters (tiny)

« Reply #27 on: March 03, 2018, 01:33:13 am »
Quote
I hope my effort is respectful and honoring of that tradition. If not please complain and I will change name (alas poor Erik, another name to track!)

My utilities, my whatis parser, my SICK interpreter, and my QB64shell all indicate the road I've traveled down.

If you could look at them all (in my signature), I'm sure they will help and be of some aid.

Although I will admit my interpreter was born of a recursive descent parser. If you need to adapt a tokenizer or such to
your own then you are on your own.

Erik.
 Logged
Games: DNDDOOR - https://bit.ly/EriksDNDDoor DUNGEON - https://bit.ly/EriksDungeon
Interpreter - https://bit.ly/EriksSICK Hex Editor - https://bit.ly/EriksHexEditor
Utilities - https://bit.ly/EriksUtils Old QB64 - https://bit.ly/OldQB64
QB64 shell - https://bit.ly/QB64shell
Print
Pages: 1 [2]
« previous next »
QB64 Community »
Programs (.BAS), Tutorials and Libraries ($INCLUDE, DECLARE LIBRARY, ...) »
Sample Programs (Moderators: Galleon, OlDosLover, SMcNeill, Kobolt) »
Novelty Interpreters (tiny)
 


SMF 2.0.3 | SMF © 2011, Simple Machines
XHTML
RSS
WAP2



Offline +KZ

  • Newbie
  • Posts: 21
  • an ugly avatar :)
allow multiple windows on same program will be nice :)
google translate :0

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Quote
Posted by: +KZ
« on: Yesterday at 02:21:08 PM »Insert Quote
allow multiple windows on same program will be nice :)
Yes I can agree
but in this case  QB64 isn't emulate QB45 and its following version of DOS ... (PDS  and VB DOS).
Programming isn't difficult, only it's  consuming time and coffee

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
Re: QB64 v1.5 Feature Request - A meaningless request for IDE
« Reply #26 on: June 28, 2020, 12:13:02 am »
Would be useful (for me anyway) to have a bit more control of spacing of program contents.

At present everything after ' is preserved but usually not relative to the '

If, with multi-program lines per IDE line, it is required to "space-out" the components (purely for visual presentation purposes only), then the only option appears to be:-

IDE > Options > OFF (Auto spacing & Upper/Lowercase Formatting)

However, if at any stage the flag for (Auto spacing & …) is changed - then all "manual" changes applied are lost forever. Also the Upper/Lowercase Formatting may be affected.

So the "Meaningless Request for IDE" is to allow preservation of manually applied spaces which will  be preserved irrespective of configuration changes to the IDE Options Menu. At present inserting a number of colons (:) is the "safest" option to space out (without resorting to using a text editor for manual formatting). If there was say a character (eg chr$(&HFF)) which does the same job as a : but does not display anything (like a space character) - this would be useful.

Hopefully a feature that effectively "does nothing" would be easy to implement.


(a silly) example:-
 

' IDE > Options >   OFF  (Auto spacing & Upper/Lowercase Formatting)

a = 1: B    =    2:      c = 3        :::  :: d = 99
aa = 1 'cannot TAB or space at beginning of this line
ccc = 0

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
Re: QB64 v1.5 Feature Request - A meaningless request for IDE
« Reply #27 on: June 28, 2020, 03:52:28 am »
Quote
From the old [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] days what author-topic was most viewed (and approximately how many views).
Damnation! GDK was second!

Quote
allow multiple windows on same program will be nice :)
You can do this, either using VQB to have seperate frames in your window, my sfml lib (allows 5 screens but only works with .954(sdl)) or use RhoSigma's GUI Framework to have multiple screens.

Failing that, have a Debug flag and print your variables over your code (i use this method a  lot), or you could just dump those variables to an external .txt file.

Unseen

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
Re: QB64 v1.5 Feature Request - A meaningless request for IDE
« Reply #28 on: June 28, 2020, 11:36:58 am »
Just want to know who the poor busterd was that made up the .3 of a male in the male to female ratio!  didn't realize we had a female component back on .NET!
Getting closer to that 2011 member stat though!

Still miss poor Clippy he was always quite a gas.(or just full of it)
Granted after becoming radioactive I only have a half-life!

Offline davidshq

  • Newbie
  • Posts: 55
Re: QB64 v1.5 Feature Request - A meaningless request for IDE
« Reply #29 on: June 28, 2020, 10:49:21 pm »
I'd like for Felippe's QB64 interpreter, vWatch, and InForm to all be bundled with QB64 (not the source, just binaries, folks can go grab the source from the repos if desired).

I don't know that any of these need to be part of QB64, but could be nice if one could tick a setting in QB64 IDE that would show/hide these options. Clicking on one would simply launch that application. Not a big change, but nice.