r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Dialects] Questions about how to create dialects

Geomol
24-Jun-2007
[173]
I added a few new things to the BASIC:

added DELETE command, added arguments to LIST, added STOP statement 
and some more (see source). Example of use:

>> do http://www.fys.ku.dk/~niclasen/rebol/basic.r
connecting to: www.fys.ku.dk
Script: "BASIC" (24-Jun-2007)
BASIC

>auto 5 5
    5 print "Line 5"
   10 rem goto 20
   15 blab
   20 print "Line 20"
   25 stop
   30 0
>run
Line 5

Mistake at line 15
>10 goto 20
>run
Line 5
Line 20

STOP at line 25
>
[unknown: 9]
24-Jun-2007
[174]
Yes, I was not suggesting YOU do this, but rather than it be a goal 
of the Rebol community...
Geomol
24-Jun-2007
[175x5]
I use this guide as a base for the BASIC interpreter: http://www.nvg.ntnu.no/bbc/doc/BBCUserGuide-1.00.pdf
I found it on this site: http://www.nvg.ntnu.no/bbc/docs.php3
I choosed that one, because I once owned a BBC Micro. I have no idea, 
how far that is from QBasic. But I guess Basic is Basic. They probably 
differ in stuff like graphics and sound.
To Gress's post:

1) Yes, it's interesting to find out, how much we get for free using 
e.g. blocks in REBOL to simulate lists in other languages. Maybe 
using hash! will benefit in some situations!?

2) Using rebcode is also a way to write lower level code. But it 
should also be possible to define REBOL functions, that work like 
(or simulate) the lower level commands in other languages. 

3) Yes, it would be interesting to find out, how languages differ 
in their cores.
LOL (I can't spell your name, sorry!)
*To Gregg's post*
Read before you post! Read before you post! Read before you post!

(Does that help? ;-) Well, we sometimes get a laugh, when people 
don't do that.)
Sunanda
24-Jun-2007
[180]
Could this group we [web-public]?

It's an interesting discussion of techiqyes that deserve a wider 
appreciation.
Gregg
24-Jun-2007
[181]
Web public. Yes
Gress = Gregg. NP :-)


QBASIC - Ahhh, now we get to have some fun. QBASIC is not your old 
fashioned, line-numbered BASIC. I think it would be cool to do both, 
but the Q(Quick)BASIC language is much better for writing programs 
that actually do something. I've been tempted to do something like 
that myself. To actually run exisiting QB code, screen access would 
pretty much be a must-have feature. Nothing like those old character 
mode interfaces you know.
[unknown: 9]
25-Jun-2007
[182]
Gregg, yes, you se my point....Sunanda, agreed.
Volker
25-Jun-2007
[183]
If you want basic, why not take one and use r3-dll? :)
Geomol
25-Jun-2007
[184]
I also haven't got any problem with this group going web-public. 
I guess, it's just to change it.
Volker
25-Jun-2007
[185]
Web public. Yes
Allen
25-Jun-2007
[186]
A z-machine interpreter could be fun - plenty of infocom games to 
play. ... http://en.wikipedia.org/wiki/Z-machine
Sunanda
25-Jun-2007
[187]
Thanks......I've changed the designation to [web-public]:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/aga-display-posts.r?post=r3wp248x150
Graham
30-Jun-2007
[188]
http://maschenwerk.de/foerthchen/


This guy has written a forth in javascript ... guess it's doable 
in Rebol
Geomol
17-Jul-2007
[189x2]
The start of a BBC BASIC interpreter using string parsing: http://www.fys.ku.dk/~niclasen/rebol/bbcbasic.r
How do we best get this rolling? I'm interested in making some language 
interpreters in REBOL, because I see future potential. Reichart and 
Gregg talked about QBASIC, which I don't know. Where are the specifications 
for that language? BASIC is a start, and along the line, I would 
like to dig into other languages as well. Is it best keeping it all 
public, or should we make new groups for teams interested in this?
btiffin
17-Jul-2007
[191]
Very nice...  As for the other questions...can't say...but well done 
sir.  And a nice reading code space to boot.
Gregg
18-Jul-2007
[192x4]
Nice John! I'm not sure how best to get rolling. I'm totally buried 
at the moment, but I can provide web space for the project if we 
need that. I also a number of grammars and things here, if we need 
references.
Oddly, I don't seem to have a QBASIC grammar. :-\
I started on a VB grammar once, which is similar, and I still have 
most of my manuals here somewhere. :-)
Not sure if the various sites for lex/yacc tools and such might have 
one/
Geomol
18-Jul-2007
[196x8]
Gregg, first I'm making a simple 'engine' or 'template' for BASIC. 
Today I implemented expressions, some simple string handling and 
a little more. I'll make conditions (IF) and loops (FOR), then that 
should be a good start to build on.
Uploaded new version of BBC BASIC intepreter. Added expressions and 
conditions. Added IF and INPUT. Example:

>> do http://www.fys.ku.dk/~niclasen/rebol/bbcbasic.r
connecting to: www.fys.ku.dk
Script: "BBC BASIC" (18-Jul-2007)
BASIC v. 0.0.2 

>auto
   10 input "Name",name$

   20 if name$="Carl" then print "Hi " name$ else print "Hello " name$
   30 0
>run
Name?John
Hello John
So far this is implemented:

Keywords: AUTO, DELETE, LIST, NEW, OLD, GOTO, RUN, END, IF, INPUT, 
LET, PRINT, REM, STOP
Functions: COS, SIN
Expressions can beside unary +, - use: +, -, *, /, ^, (, )
Conditions can use: or, eor, and, =, <>, <=, >=, <, >
It's possible to add strings together and strings can also be tested 
in conditions.
3 datatypes is implemented. Examples:
a$ is a string
a% is an integer
a is a real.
*are implemented*
Use a zero (0) to leave AUTO. Pressing <Esc> will end the BASIC intepreter.
New version 0.1.0 of BBC BASIC. Added FOR ... NEXT loop. Example:

>> do http://www.fys.ku.dk/~niclasen/rebol/bbcbasic.r
connecting to: www.fys.ku.dk
Script: "BBC BASIC" (19-Jul-2007)
BASIC v. 0.1.0 

>auto
   10 for a=10 to pi step -2.3
   20 for n%=1 to 3 step 2
   30 print a n%
   40 next
   50 next
   60 0
>run
                  10                   1
                  10                   3
                 7.7                   1
                 7.7                   3
                 5.4                   1
                 5.4                   3
[unknown: 9]
18-Jul-2007
[204]
Cute.
Geomol
19-Jul-2007
[205x2]
A modern BASIC should maybe be able to recognize both lower an UPPER 
case, like in my examples. The original BBC BASIC distinguish between 
upper and lower case. I should change my interpreter to work this 
way, so already written programs will work.
Or maybe the problem is only with variables!? Hmm
Louis
19-Jul-2007
[207]
http://www.programatium.com/en/programming4/qbasic.htm
http://www.qbasic.com/wbb/filebase_entry.php?entryid=50&
Geomol
19-Jul-2007
[208]
New version 0.1.1 of BBC BASIC. Added many keywords, mostly functions. 
To run:
>> do http://www.fys.ku.dk/~niclasen/rebol/bbcbasic.r

List of keywords: http://www.fys.ku.dk/~niclasen/rebol/bbcbasic.html
Geomol
22-Jul-2007
[209x6]
Version 0.2.0 of BBC BASIC uploaded. Added DATA, READ and RESTORE. 
Added GOSUB and RETURN. Added hex notation, made some changes and 
fixed bugs.
This is meant as an implementation of BBC BASIC originally found 
on the BBC Micro from british Acorn. It's not an emulator of that 
computer. For emulation of the BBC Micro, I recommend BeebEm.
One thing is to implement old languages, it could also be interesting 
to make a modern BASIC using block parsing in REBOL. That way, it 
would be possible to easily implement many of the datatypes found 
in REBOL. Also imagine to be able to have BASIC (or other language) 
code in the middle of a REBOL script, doing something like:
... (some REBOL code) ...
BASIC [
... (some BASIC code) ...
]
... (more REBOL code) ...
The BBC BASIC interpreter is now more than 800 lines of REBOL source 
(or 20278 bytes). It's 4568 bytes compressed.
In the early 80'ies, before the era of PCs, the Amiga, Mac and Linux, 
there were a whole range of home computers more or less expensive 
(the BBC Micro were in the high price range back then). They all 
came with some version of the BASIC language. It was also possible 
to program in assembler (the BBC had a 6502 CPU). Imagine a new homecomputer 
with REBOL and rebcode. And many other languages supported as REBOL 
dialects. It should just have a keyboard, network, some RAM and maybe 
a memory stick instead of a harddisk. And connection to a monitor. 
That shouldn't be too costly to produce. Would it sell if the price 
was right?
Oh, and it should have a low-energy CPU to run the scripts, something 
as the G3, I think IBM made to only use 1-2 Watt. Then it could be 
sold all over the World.
Henrik
22-Jul-2007
[215x3]
geomol, I think you'd have to price it like a midsized calculator
I think also we need a new age of exploratory computing (meaning, 
people exploring other than porn sites and youtube), and it requires 
its own hardware.
the problem is that people expect to do everything on a PC, whereas 
in the 80's, people expected to do everything on a C64.
Pekr
22-Jul-2007
[218]
Geomol - there is one strong and modern Basic implementation - Free 
Basic?
Geomol
22-Jul-2007
[219]
Pekr, is it strong enough? As datatypes, it support different kinds 
of integers, floating-point and strings. BASIC as a REBOL dialect 
would be able to have much more, wouldn't it?
Gregg
22-Jul-2007
[220]
Wow John! I haven't even had a chance to look at it since the original 
release and you're already on v2, well, 0.2, but still. :-) And, 
yes, I think it would be very cool to have a BASIC that supports 
REBOL's datatypes. Part of my, perhaps not so hidden, agenda for 
these things--in addition to being great for teaching language design 
and construction--is to show how REBOL can work *inside* the idioms 
other languages use.
Geomol
22-Jul-2007
[221]
:-) I have a feeling, that dialects is a good way to go, because 
so many problems become much easier to solve.
Gabriele
23-Jul-2007
[222]
Geomol, the problem with such a computer is that it would only appeal 
to geeks, and geeks already have a pc anyway. for developing countries, 
there's the OLPC eventually.