flat assembler
Message board for the users of flat assembler.

Index > Windows > How search in text defines ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1088
Roman
Fasmw 1.73
I want do this. Parse on fasm text.
Load text file in TxtBuffer and find all defs.
My text look like this:
Code:
#def Blob = "text"
#def A = 2,Blob,10
#def B = 3,1,5,6

X = A.0 ; do x = 2
Z = B.1 ; do Z = 1

    


My question how do fast\more efective searching in X and Z A and B ?
Because if i have thousand #defs and thousand values (like X Z )its slow down my program.

I dont know what do good.
Search all #defs and put in another buffer.
Or always search in X A then search in text #def A ?
Post 11 May 2021, 05:26
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3388
Location: vpcmipstrm
bitRAKE
Don't update dynamically. Instead only update part that changes. Loading a new file will still incur a delay, but active file updates will be negligible. The fasm source itself is a good example on how to store the symbols.
Post 11 May 2021, 08:08
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1012
Location: Belarus
DimonSoft
As soon as you use . as a delimiter you’re stuck with assembler stage to parse this stuff. As soon as you use # as the first character of certain lines you’re stuck with switching to another tool.
Post 11 May 2021, 08:17
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1088
Roman
Dimon Soft please say you algorithm and your proposition.
More concrete to my problem.
Post 11 May 2021, 10:20
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1012
Location: Belarus
DimonSoft
FASM uses # as a special character. I really doubt there’s a way to override it to be ignored while leaving it possible to use it in macros (which might be useful for the rest of parsing).

Breaking an identifier into parts on dots is hardly possible with preprocessor, so the only way might be to convert it to string data in a virtual block and then walking through it somehow converting the string parts to an index into another virtual block that would store actual values. Doesn’t look promising as well.
Post 11 May 2021, 12:39
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1088
Roman
I write my parser program.
And write parser on asm.
I mean this.

I want own script language.
Post 11 May 2021, 14:02
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1012
Location: Belarus
DimonSoft
Ah, sorry. Is it going to be limited to the features you’ve shown? Just plain value lists and indexing into them? Or we’re talking about complex scripting language in the future?
Post 11 May 2021, 19:40
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1088
Roman
I changed my script logic.
And now I don't need defs and x z.
No need search and parse defs and x z.
Now my parser more simple, faster and small.
Post 12 May 2021, 06:36
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.