English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2007-07-01 22:56:34 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

Your program or function will accept a string of data and possibly a string parse character (what to parse on) and possibly a starting position in the string of data.
The program will return an array of data.
If there is no parse character then the program will parse on a space.
Starting position will be 0 or the input starting position.
endLocation= first parse character position.
Loop until endLocation < 0
array(n)=substring(start, endLocation)
n++
start=endlocation+1
endlocation=next parse character position
EndLoop
return array

So why couldn't you do that?

2007-07-01 23:30:05 · answer #1 · answered by AnalProgrammer 7 · 0 0

If you are trying to do anything more than trivial, you should look into using a parser generator. There are a number of tools that convert regular expressions into LALR or LR parsers.

YACC and its variants (inc. BYACC and BISON) are commonly used. If you go that route you might want to get John Levine's YACC book from O'Reilly

These tend not to be trivial to use and some "languages" (e.g. C/C++) tend to be difficult to parse in context-free grammars.

2007-07-02 03:25:57 · answer #2 · answered by Bill G 2 · 0 0

Please provide more details, else ask expert help for free at http://askexpert.info/

2007-07-01 23:20:06 · answer #3 · answered by easymf co in 3 · 0 0

fedest.com, questions and answers