锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
1.Writing own regular expression parser
By Amer Gerzic鑻辨枃鐨?/a>
http://www.codeproject.com/KB/recipes/OwnRegExpressionsParser.aspx
鏈夋簮鐮?br>2. 銆婃瀯閫犳鍒欒〃杈懼紡寮曟搸銆嬫柊椴滃嚭鐐夊暒錛?/a>涓枃鐨勶紝by vczh,鍗庡崡鐞嗗伐澶у
http://www.shnenglu.com/vczh/archive/2008/05/22/50763.html
闃呰瀹屼笂闈袱綃囨枃绔狅紝鍐欎釜鑳藉榪愯鐨刲exer灝變笉鎴愰棶棰樹簡銆?br>鍙﹀闄勪笂榫欎功錛圕ompilers, principles techniques and tools錛夐噷涓孌祎oken,pattern鍜宭exeme鏈鐨勫尯鍒細(xì)
1. A t o k e n is a pair consisting of a token name and an optional attribute
value. The token name is an abstract symbol representing a kind of
lexical unit(lexeme), e.g., a particular keyword, or a sequence of input characters
denoting an identifier. The token names are the input symbols that the
parser processes. In what follows, we shall generally write the name of a
token in boldface. We will often refer to a token by its token name.
2. A pattern is a description of the form that the lexemes of a token may take.
In the case of a keyword as a token, the pattern is just the sequence of
characters that form the keyword. For identifiers and some other tokens,
the pattern is a more complex structure that is matched by many strings.
3. A lexeme is a sequence of characters in the source program that matches
the pattern for a token and is identified by the lexical analyzer as an
instance of that token.
notes:
1. more than one lexeme can match a pattern
2. 鐪嬬湅example 3.1
]]>
1. Understand the basic of lexical parse and syntax parse, know what they are used for separately. The former with regular expression to recognize tokens, the latter using operator precedence/recursive descent to build a syntax tree for continuing step, e.g, computing the math expression. The former is considered on character, while the latter is on token.
2. Have a superficial knowledge in Automate, know how to build a FA for specific regular expression and reduce e-FA to FA, if the result is NFA, then convert to DFA
3. I find rolling dice can reduce to a SM.
Todo in coming week:
1. Study the internal lexical and syntax parts of muParser.
2. Write code for my own math expression parser.
3. Add 'If' and 'while' to the parser using my own way, then read more in Parsing related Docs for better solution.
Time stamp:
1:00 May.12.2008