RetroBASIC

Basicprogramming(.org) => Code and examples => Topic started by: Aurel on August 27, 2018, 05:47:33 PM

Title: ?
Post by: Aurel on August 27, 2018, 05:47:33 PM
in
Title: Re: LOGO interpreter ?
Post by: Tomaaz on August 27, 2018, 06:25:43 PM
Hey, wasn't it me who supposed to show new copy/paste tricks?
Title: Re: LOGO interpreter ?
Post by: Aurel on August 28, 2018, 06:30:28 AM
-
Title: Re: LOGO interpreter ?
Post by: Tomaaz on August 28, 2018, 07:51:01 AM
Aurel, come on. Any information about the source? Where did you find it? Who's the author? Please.
Title: Re: LOGO interpreter ?
Post by: B+ on August 28, 2018, 12:17:16 PM
It would be nice for sample screen shot.

Code: [Select]
GraphicsWindow.Title = "Logo - by Joseph Fischetti"not one of original authors of LOGO:  https://en.wikipedia.org/wiki/Logo_(programming_language)
so must be MS Small Basic coder?

This is really the same as Basic DRAW command, I think, again sample(s) would be nice. Oh looks like it works from run time Input like function.

Oh hey, Write a Draw String and not just draw from a string? That is interesting idea! :)
Then we have makings of editor for a Draw String, hmm...
Title: Re: LOGO interpreter ?
Post by: Aurel on August 28, 2018, 12:20:34 PM
-
Title: Re: LOGO interpreter ?
Post by: B+ on August 28, 2018, 12:31:19 PM
Don't usually think of Basic DRAW as Interpreter!

Really don't need all that parsing and stack stuff, recursive calls could handle repeat section(s).
Title: Re: LOGO interpreter ?
Post by: ZXDunny on August 28, 2018, 12:44:17 PM
Seems to use an internal turtle? So this basically just extracts logo-alike commands from a text string and feeds them one by one to a turtle. Does it handle expressions as arguments? I couldn't see anything that might in there. Also no procedure definitions using the Logo "to" command as far as I can tell. Would be nice if we could add variables and procedures/lists to it.
Title: Re: LOGO interpreter ?
Post by: Aurel on August 28, 2018, 01:38:26 PM
Y
Title: Re: LOGO interpreter ?
Post by: B+ on August 28, 2018, 02:04:10 PM
Seems to use an internal turtle? So this basically just extracts logo-alike commands from a text string and feeds them one by one to a turtle. Does it handle expressions as arguments? I couldn't see anything that might in there. Also no procedure definitions using the Logo "to" command as far as I can tell. Would be nice if we could add variables and procedures/lists to it.

Well with procedures, might like execution redirection with decision mechanism(s).

But there is a point when I say to myself, "Oh heck! Just code it in Basic!"
Title: Re: LOGO interpreter ?
Post by: ZXDunny on August 28, 2018, 10:10:26 PM
If anyone cares to, they can run this for a more powerful experience with SpecBAS :)

Code: [Select]
10 ON ERROR GO sub 30
20 INPUT a$: EXECUTE TOKEN$ a$: GO TO 20
30 PRINT "error!": RETURN

You can type in as much BASIC as you like (and there's a turtle too...) and even store procedures and functions as strings and call them later...
Title: Re: LOGO interpreter ?
Post by: B+ on August 29, 2018, 04:50:53 AM
So TOKEN$ could be a whole code file? what about line numbers?
Title: Re: LOGO interpreter ?
Post by: ZXDunny on August 29, 2018, 08:26:54 AM
So TOKEN$ could be a whole code file? what about line numbers?

No, just direct commands. TOKEN$ compiles the text into p-code, EXECUTE runs it (though TOKEN$ is probably redundant as EXECUTE will perform this step if it hasn't already - compiling will slow the interpreter down somewhat though). You can specify many statements using the ":" separator.
Title: Re: LOGO interpreter ?
Post by: B+ on August 29, 2018, 12:30:31 PM
OK so like Immediate Mode in early Basic's, though I don't think I ever tried a subroutine.
Title: Re: LOGO interpreter ?
Post by: ZXDunny on August 29, 2018, 02:40:39 PM
OK so like Immediate Mode in early Basic's, though I don't think I ever tried a subroutine.

Subroutines would be pretty easy.

you would input your sub as a line of code assigned to a string variable:

Code: [Select]
sub$="FOR i=1 TO 5: DRAW 100: ROTATE 144: NEXT i"

then for your next inputs, you could do:

Code: [Select]
PLOT SCRW/2, SCRH/2: DEGREES: FOR j=1 TO 10: EXECUTE sub$: ROTATE 36: NEXT j

And that would draw 10 stars rotated. I think :)