July 06, 2020, 08:55:04 AM

Author Topic: o2Basic - micro(A) Interpreter  (Read 2927 times)

guest7581

  • Guest
Re: o2Basic - micro(A) Interpreter
« Reply #30 on: April 18, 2020, 03:38:52 PM »
That was rather straightforward question. What is your plan for that interpreter? What are your goals?

The real life of everyone on Earth is seriously being influenced by this new coronavirus. For example, our jobs. Now many things are much more important than hobby programming

Well, that depends. Many people are stuck at home. From this perspective, it's a perfect time for hobby programming.


Offline round157

  • Sr. Member
  • ****
  • Posts: 352
Re: o2Basic - micro(A) Interpreter
« Reply #31 on: April 18, 2020, 07:52:49 PM »
- are you planning to finish this one?

Some forum members may want to know the ETA for the micro(A) interpreter.


Offline round157

  • Sr. Member
  • ****
  • Posts: 352
Re: o2Basic - micro(A) Interpreter
« Reply #32 on: April 19, 2020, 03:00:14 AM »
AurelBasic...oh that was a long time ago...Ruben,,

Hello..., a question. Will micro(A) be compatible with Raylib? Sorry...my English is poor. I mean, can both softwares work together in the future?

Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #33 on: April 19, 2020, 02:22:01 PM »
To answer on what i have in plan is :
1. publish source code of lexer on github
2. publish source code of pre-procesor & parser on github

And one thing that i don't want to publish in source code
will be runtime of interpreter.

Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #34 on: May 11, 2020, 11:37:24 AM »
After some testing i finally test string variable expression using recursive descent method.
very similar to numeric exxpression but just with operator "+"

test code: "varStr a,c : a=" + DQ +"_ aurel" + DQ + crlf + "c=a" + crlf 

and here is method in few functions:
Code: [Select]
' execute string expression---------------------------------------------
Sub exec_strExpr() as string
gettok()'start
string res
res = strExpr()
MsgBox "STR_RESULT=" + res , "EXEC_STR_EXPR:"
TextOn (win,30,60, res)
Return res
End sub

'----------------------------------------------------------------------
Sub strExpr() as string
string vs

if token <> "+"
vs = strFactor()
end if

while token = "+"
if token = "+": gettok() : vs = vs + strFactor(): end if
wend

return vs
End Sub

'---------------------------------------------------------------------
Sub strFactor() as string
string vs : int vID, vTyp

if tkTyp = tkIDENT
print "IDENT-STR:" + token
vID = varList[tc]  : vTyp = varType[vID] : print "token->"+ token +" var_ID:" + str(vID) + "_varType: " + str(vTyp)
IF vTyp = tkSTRING : vs = varStr[vID] : end if
 gettok()
end if

if tkTyp = tkQSTRING
print "STR-FACTOR:" + token
vs = token :  gettok()
end if

return vs
End Sub

Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #35 on: May 11, 2020, 08:40:24 PM »
code in editor should look like this:
varStr a,b,c : a="aurel"
b=" micro(A)"
c=a+b


Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #36 on: May 12, 2020, 10:22:12 AM »
test numeric and string expressions:
              varStr a,b,c : varNum d,e,f
              d=625 : e=25.1 : f = d/e
              a= "aurel"
              b= " micro(A)"           
              c=a+b


Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #37 on: May 17, 2020, 11:31:59 AM »
After error checking I am close to REPL execution .
Well this error checking use too much time but is important part.
When i say REPL..in fact it would be REP ..Read..Eval...Print
Loop will be next step..so for now,,it is ;

varStr a,b,c : varNum d,e,f
 d=625 : e=25.1 : f = d/e : print 10,10,f
 print 10,30,"numeric expr OK!"
 a= "aurel"
 b= " micro(A)"           
 c=a+b
print 10,50,"string expr OK!"


Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #38 on: May 17, 2020, 11:02:02 PM »
REP test finished:

varStr a,b,c : varNum d,e,f
 d=625 : e=25.1 : f = d/e : print 10,10,f: print 50,10,"..numeric Expr"
 a= "aurel"
 b= " micro(A)"           
 c=a+b
print 10,30, c : print 150,30,"..string expr OK!"



Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #39 on: May 18, 2020, 07:25:44 AM »
And here is how look in editor:

Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #40 on: May 20, 2020, 11:14:46 PM »
First test of REP with micro Editor:

Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #41 on: June 02, 2020, 10:28:34 PM »
testing IF statement:

Offline round157

  • Sr. Member
  • ****
  • Posts: 352
Re: o2Basic - micro(A) Interpreter
« Reply #42 on: June 03, 2020, 01:40:41 AM »
It's certainly fun to read your posts about the progress of the program.

Thanks for all the hard work.

Good work so far.




Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #43 on: June 03, 2020, 01:21:09 PM »
thanks round157
It is not that hard than is slow..lot of things for error checking.

Offline Aurel

  • Full Member
  • ***
  • Posts: 163
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #44 on: June 07, 2020, 03:34:20 PM »
..and simple testing of IF_ELSE_ENDIF
in a cca 500 LinesOfCode..
 :)

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal