Professional Documents
Culture Documents
Search
News:
InstructionsforcreatingAndroidApps:
http://www.qb64.net/forum/index.php?topic=13162.0
Home
Help
Search
Login
Register
previousnext
Pages:[1]
Author
P RI N T
Topic:AsimpleBASICInterpreterwritteninC(Read6253times)
AsimpleBASICInterpreter
writteninC
OlDosLover
Moderator
HeroMember
Posts:5329
OlDosLover
on:June22,2013,04:42:24am
Hiall,
InmytravelsicameacrossaverysmallCBasicIntrepetor.Whatwouldbe
reallygoodwouldbeifsomeoneknowledgableinCcouldconvertthistoQB64.
HeretheoriginalCcode.
Code:[Se le ct]
- Line editor using line re-entry.
- A line number with nothing following it, deletes the line.
- Line number range
1-10000
Input format:
- ALL INPUT MUST BE UPPERCASE.
- No space is allowed before the line number.
- Exactly one space is needed between the OLD or SAVE command and
the filename.
No error checking is performed.
The message 'core dumped' or 'bus error'
signifies a syntax or semantic error.
*/
Hereisanotherbugcorrectionversionofabove.
Code:[Se le ct]
http://www.qb64.net/forum/index.php?topic=11134.0
1/11
15/12/2015
RUN
Thiscameaboutfromthispost:
http://forum.basicprogramming.org/index.php/topic,2954.0.html
OlDosLover.
Logged
Re:AsimpleBASICInterpreter
writteninC
Amaysim
Jr.Member
Reply #1on:June22,2013,06:56:08am
WhatsaBasicIntrepetorandwhatdoesitdo?
Ama
Logged
Posts:54
Re:AsimpleBASICInterpreter
writteninC
DSMan195276
HeroMember
Reply #2on:June22,2013,12:01:26pm
SorryOlDos,
Posts:2113
Quote
Yes
There'snexttonohopeofconvertingthisunlessthereisanunobfuscated
versionofthecodesomewhere.
Matt
Logged
"C astyourcaresontheLordandhewillsustainyouhewillneverlettherighteousbe
shaken"Psalm55:22
QB64LinuxInstaller
Re:AsimpleBASICInterpreter
writteninC
Galleon
Administrator
HeroMember
Reply #3on:June22,2013,05:19:12pm
Thetroubleisthattheinterpreterwouldbesolimitedthatyou'dbebetteroff
rollingyourownanyway.InfactI'veseenaninterpreterwritteninQBcode,it
mayevenbeintheexamplessomewhere.
Posts:5464
hereitis:
http://www.qb64.net/forum/index.php?topic=11134.0
2/11
15/12/2015
QBForever
Code:[Se
le
ct]
IF ACCEP
T(
"-") THEN
FACTOR% = -FACTOR%
EXIT FUNCTION
END IF
IF ACCEPT("(") THEN
FACTOR% = EXPRESSION
CALL EXPECT(")")
EXIT FUNCTION
END IF
IF LEFT$(TOK$, 1) >= "0" AND LEFT$(TOK$, 1) <= "9" THEN
FACTOR% = NUM
CALL GETSYM
EXIT FUNCTION
END IF
IF LEFT$(TOK$, 1) >= "A" AND LEFT$(TOK$, 1) <= "Z" THEN
FACTOR% = VARS(GETVARINDEX)
EXIT FUNCTION
END IF
Logged
Somethingold...Somethingnew...Somethingborrowed...Somethingblue...
Re:AsimpleBASICInterpreter
writteninC
OlDosLover
Moderator
HeroMember
Posts:5329
OlDosLover
Reply #4on:June22,2013,08:09:19pm
Hiall,
ThanksMattandGalleonfortheinput.Iwashopingthatthiswouldhelpus
gettoaninterpreterquicker,butalasiseenowthatisntso.
OlDosLover.
Logged
Re:AsimpleBASICInterpreter
writteninC
OlDosLover
Moderator
HeroMember
Posts:5329
OlDosLover
Reply #5on:June22,2013,10:10:04pm
Hiall,
Thelinkthatipostedistoasitewhereafellaredidthis.Hereishiswork.
Quote
Ilik e foolingaroundwithtinyinte rpre te rs.Alongtim e ago,IfoundDDSBASIC by
Diom idisSpine llis,awinne rinthe 1990IO C C C .Ide cide dafunproje ctwouldbe to
m odifyDDSBASIC ,addinge noughfe ature ssothatitcouldrun(whate lse )Tiny
StarTre k .So,Ididthe followingtothe originaldds.c:
R e m ove de noughobfuscationtoallowm odifications
AllBASIC k e ywordsare nowlowe rcase
Acce ptscom m andline input
Adde dasingle inte ge rarray:@
Adde dthe state m e ntcontinuationcharacte r:":"
Adde d'prom pt'oninputstate m e nt
Enhance dprintstate m e nt
Adde drnd(),asc()andabs()functions
C onve rte dthe re cursive de sce nte x pre ssionparse rtopre ce de nce clim bing
Enhance d'if'toallowstate m e ntstofollow(inste adofjust"ife x prthe nline
num be r")
Inthe spiritofthe originalDDS,noe rrorche ck ingyou've be e nwarne d!
Andhe re itis(stillpre ttysm allatonly318line sofcode ):
C ode :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype .h>
e num {false ,true }
type de fchar*C HAR P
http://www.qb64.net/forum/index.php?topic=11134.0
3/11
15/12/2015
http://www.qb64.net/forum/index.php?topic=11134.0
4/11
15/12/2015
//se tstopointtofirstcharofline
while (line num ){
http://www.qb64.net/forum/index.php?topic=11134.0
5/11
15/12/2015
http://www.qb64.net/forum/index.php?topic=11134.0
6/11
15/12/2015
http://www.qb64.net/forum/index.php?topic=11134.0
7/11
15/12/2015
http://www.qb64.net/forum/index.php?topic=11134.0
8/11
15/12/2015
HereisalinktoacompiledversionforWinand
Linux.http://forum.basicprogramming.org/index.php?
action=dlattachtopic=2954.0attach=1389
OlDosLover.
Logged
OlDosLover
Re:AsimpleBASICInterpreter
writteninC
http://www.qb64.net/forum/index.php?topic=11134.0
9/11
15/12/2015
Moderator
Reply #6on:June25,2013,11:00:12pm
HeroMember
Posts:5329
OlDosLover
Hiall,
Cameacrossaninterestinglink:
https://sites.google.com/site/smallbasicinterpreters/
OlDosLover.
Logged
Re:AsimpleBASICInterpreter
writteninC
OlDosLover
Moderator
HeroMember
Posts:5329
OlDosLover
Reply #7on:June26,2013,12:17:11am
Hiall,
Here'sareferencebook.
https://dl.dropboxusercontent.com/u/10291175/SICP
Intrerpretor%20Book1.7z
OlDosLover.
Logged
Re:AsimpleBASICInterpreter
writteninC
OlDosLover
Moderator
HeroMember
Posts:5329
OlDosLover
Reply #8on:June26,2013,12:24:33am
Hiall,
Anotherknowledgeableresourcegroup.
http://tech.groups.yahoo.com/group/QDepartment/
OlDosLover.
Logged
Re:AsimpleBASICInterpreter
writteninC
qbguy
Sr.Member
Reply #9on:July01,2013,12:02:30pm
Posts:263
Quotefrom:OlDosLoveronJune26,2013,12:17:11am
Hiall,
He re 'sare fe re nce book .
https://dl.dropbox use rconte nt.com /u/10291175/SIC PIntre rpre tor%20Book 1.7z
O lDosLove r.
ThebookStructureandInterpretationofComputerProgramshasaPDFversion
athttp://sicpebook.files.wordpress.com/2012/11/sicp.pdf
andisavailableonlineathttp://mitpress.mit.edu/sicp/fulltext/book/book.html
Therearealsosomevideostogowithit.Itdescribesaninterpreteranda
compilerforScheme.
Logged
Pages:[1]
P RI N T
previousnext
QB64C ommunity Development Development(Moderators:Galleon,OlDosLover,SMcNeill,Kobolt)
AsimpleBASIC InterpreterwritteninC
Ju m p to : =>Development
http://www.qb64.net/forum/index.php?topic=11134.0
go
10/11
15/12/2015
http://www.qb64.net/forum/index.php?topic=11134.0
11/11