News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

String parsing tutoria anywhere?

Started by travism, November 02, 2008, 03:51:56 AM

Previous topic - Next topic

travism

Is there a string parsing tutorial anywhere? Im getting so frustrated everything I want to make needs insane amounts of it.. :( Yet Ive tried/read so many things yet nothing makes since is there one anywhere or a program anywhere with alot of it in it to try and understand it?

hutch--

Travis,

Its a reasonably complicated area but there are a number of string functions/macros in the masm32 library that can do many common things. You can write either unicode 2 byte characters or the older ANSI/ASCII style depending on what you are doing and essentially you are reading/comparing one character at a time and in most instances with a terminating zero to know the end of the string. The exception is strings of known length like OLE string.

Give us some idea of what you are doing and we may be able to help you but to address your original question, I don't know of a bare string parser tutorial as the area is very diverse.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

travism

Well I wrote my own scripting language in C, and ofcourse as you might be able to tell it takes alot of string parsing, for instance reading in a file word by word and parsing out certain bytes so for instance like

putscr ("Hello, World");

needs to read in putscr and then parse out Hello, World.

so kind of an idea.. And then I wanted to start making some apps that use command line stuff but then that is just returned as a string so i would have to parse that too..

hutch--

have a look at the two tokenisers in the MASM32 library, it will give you some idea of how to tokenise either words or lines in assembler. A slightly smarter one handles broken lines but you must devise a way to track the line numbers for error reporting.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Mark Jones

Also, here is some fully-commented code showing how ASCII .ini file data can be "parsed." This isn't especially tidy or efficient, but it is helpful for understanding. (Scroll down to the GetPrivateProfileStringML routine.)

http://www.masm32.com/board/index.php?topic=1073.0

It is much more productive to follow along with the code when it is actually running -- put that proc in a test piece and call it, then load the executable into OllyDbg and press F7 repeatedly to step through each instruction. :U
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08