Author Topic: microB tokenizer  (Read 3611 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Sr. Member
  • ****
  • Posts: 489
Re: microB tokenizer
« Reply #15 on: May 12, 2020, 01:40:10 AM »
String expression ( con cat like ) using also recursive descent method strFactor()

Code: [Select]
:code' 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
]
my site:BLOG and FORUM
https://aurelsoft.ucoz.com/

Aurel

  • Sr. Member
  • ****
  • Posts: 489
Re: microB tokenizer
« Reply #16 on: May 17, 2020, 10:24:24 PM »
-
« Last Edit: May 20, 2020, 02:25:34 PM by Aurel »
my site:BLOG and FORUM
https://aurelsoft.ucoz.com/

Aurel

  • Sr. Member
  • ****
  • Posts: 489
Re: microB tokenizer
« Reply #17 on: May 20, 2020, 02:24:16 PM »
First test of REP with micro Editor:
my site:BLOG and FORUM
https://aurelsoft.ucoz.com/