Tokenizer in QB64
#1
I am trying to modify my tokenizer written in FB to QB64
and i am getting error ..what i am doing wrong ?

Code: (Select All)
'tokenizer in QB (fb) by Aurel

'INT startTime ,endTime: float procTime  ' GetTickCount -timer init
declare function tokenizer( src as string) as integer
declare function run_tokenizer(inputCode as string) as integer

const tkNULL=0, tkPLUS=1, tkMINUS=2, tkMULTI=3, tkDIVIDE=4
const tkCOLON=5, tkCOMMA=6, tkLPAREN=7, tkRPAREN=8, tkLBRACKET=9, tkRBRACKET=10
const tkIDENT = 11 , tkNUMBER = 12 , tkQSTRING = 13, tkCOMMAND =14 ,tkEOL = 15
const tkEQUAL = 16, tkMORE = 17, tkLESS = 18, tkAND = 19, tkOR = 20, tkNOT = 21
const tkHASH=22 , tkSSTR=23, tkMOD=24 , tkSEMI=25, tkDOT=26, tkLBRACE=27, tkRBRACE=28
const  tkQUEST=29, tkMONKEY=30 , tkBACKSLAH=31, tkPOWUP=32 ,tkAPOSTR=33 , tkTILDA=34

Dim shared tokList(1024)  As string                       'token array
Dim shared typList(1024)  As integer                      'token type array
Dim shared p              As Long : p=1
Dim shared start          as Long : start = 1
Dim shared tp             as long
Dim shared tn             as long
Dim shared n              as long
Dim shared ltp            as long  : lpt = 1
Dim shared nTokens    As long                            'nTokens -> number of tokens
Dim shared lineCount As integer
Dim shared Lpar      as integer
Dim shared Rpar      as integer
Dim shared Lbrk      as integer
Dim shared Rbrk      as integer
Dim shared tokerr    as integer
Dim shared codeLen   as integer
Dim shared code      As String
Dim shared chs       As String
Dim shared tch       As String
Dim shared tk        As String
Dim shared crlf      As String
Dim shared bf        As String
Dim shared ntk       As String
crlf = chr$(13) + chr$(10)
'test string .......................................
Dim test as string  : test = "func tokenizer in QB64"
'...................................................

'call fn tokenizer()
call tokenizer(test)



' *** MAIN TOKENIZER FUNCTION ***
FUNCTION tokenizer& (src as string)
print "tokenizer run:" + src
lineCount=0:ltp=start : nTokens = 0

tokenizer& = 0
END FUNCTION




do

loop until multikey(27)
Reply


Messages In This Thread
Tokenizer in QB64 - by aurel - 02-25-2023, 02:52 PM
RE: Tokenizer in QB64 - by bplus - 02-25-2023, 03:36 PM
RE: Tokenizer in QB64 - by aurel - 02-25-2023, 03:40 PM
RE: Tokenizer in QB64 - by bplus - 02-25-2023, 03:42 PM
RE: Tokenizer in QB64 - by aurel - 02-25-2023, 03:43 PM
RE: Tokenizer in QB64 - by mnrvovrfc - 02-25-2023, 05:13 PM
RE: Tokenizer in QB64 - by aurel - 02-25-2023, 03:48 PM
RE: Tokenizer in QB64 - by bplus - 02-25-2023, 03:53 PM
RE: Tokenizer in QB64 - by bplus - 02-25-2023, 03:55 PM
RE: Tokenizer in QB64 - by bplus - 02-25-2023, 04:00 PM
RE: Tokenizer in QB64 - by aurel - 02-25-2023, 04:47 PM
RE: Tokenizer in QB64 - by aurel - 02-25-2023, 04:49 PM
RE: Tokenizer in QB64 - by aurel - 02-25-2023, 07:54 PM



Users browsing this thread: 3 Guest(s)