2 @ lxgmr, lxr and gmr processing program. ".lxgr" file combines .lxr and .gmr.
3 # use -t or -l to specify a language, get it's .lxgr file or .lxr and .gmr file
4 to process file specified in paramter.
6 @ run-time-loadµÄlxr¶¨ÒåÀ©Õ¹µÄ³£ÓÃÄÚÈÝ£º
7 # rsv-word extension as a cmd. process stdin, and output token stream.
8 # rsv-word grammar extension. rsv-word cmd append to xxx_list to be used in
9 some place, and invoke xxx_list in it's content.
10 # special signature defined as "$". process text, and output back to caching
13 # use sh-lang to process string, so that it can process on load.
15 @ lxr output stream syntax.
16 # \<RSV-WORD\>: content
18 + MODE: <token|stream>. when output token, set token into gmr program.
19 swith to stream mode, and receive other token and token content.
20 + <TOKEN>: <content>. token is the name analyzed by lxr.
21 # use ${data%%:*} to get token name with "<" and ">", use ${data#*:\ } to get
23 # or use [[ "$data" =~ ^\<([[:alnum:]_]*)\>:\ (.*)$ ]] && echo
24 "${BASH_REMATCH[@]}" to get rsv-word and its content string.
26 @ lxr¡¢gmrµÄrun-time-load
27 # loadÒ»¸ölxr¶¨Ò壬ͨ³£ÊÇÀ©Õ¹Ò»¸öreserved-word¡£
28 # ½«rsv-wordµÄgmr¶¨ÒåÔÚ.gmrÎļþ£¬ÔÚgmrÖÐÓõ½µÄtoken£¬¶¨Òåµ½.lxrÎļþ¡£
29 # rsv-wordµÄtokenÓëÆäËürsv-wordµÄtoken¶¨ÒåµÄÖظ´£¬Ê¹Óò»Í¬µÄÃû³Æ£¬ÏàͬµÄidx¡£
31 for ((i=0; i<10; i++))
35 ÐèÒªÌí¼ÓifÓï¾äµÄ((Óï·¨¶¨Ò壺
42 ÔÚforÕâ¸örsv-wordµÄlxr¶¨ÒåÖУ¬((¶¨ÒåΪT_DUAL_LPAREN£¬ÔÚifÖпÉÒÔʹÓÃÏàͬµÄ
43 Ãû³Æ£¬Ò²¿ÉÒÔ×Ô¶¨ÒåΪT_DOUBLE_LPAREN¡£µ±lexer½âÎölxr¶¨Òåʱ£¬½«((Ìí¼Óµ½tokenÁÐ±í£¬¶ÔÓ¦Ò»¸öÁбíÖеÄidxÖµ¡£µ±lexerʹÓÃlxrµÄ¶¨Òå½âÎöµ½((ʱ£¬retuan¸øgmrµÄÊÇidxÖµ¡£
44 ÔÚifµÄgmr¶¨ÒåÖÐʹÓÃT_DOUBLE_LPAREN:
45 T_IF T_DOUBLE_LPAREN expr T_DOUBLE_RPAREN
46 ÔÚgrammar½âÎöifµÄgmr¶¨Òåʱ£¬´ÓtokenµÄ¶¨ÒåÖÐÆ¥ÅäT_DOUBLE_LPAREN£¬»ñÈ¡¶ÔÓ¦µÄ
48 ÔÚgmr´¦Àíº¯ÊýÖУ¬²ÎÊý$X¶ÁÈ¡µ½µÄÊÇʵ¼ÊµÄ×Ö·û((¡£
49 Ò»¸örsv-wordµ¥¶À¶¨ÒåµÄlxrºÍgmr¿ÉÔÚruntime½øÐÐload¡£
50 ²»Í¬µÄrsv-wordµÄlxrºÍgmr¶¨Ò壬ʹÓÃÁ´±í±£´æ£¬ÏàͬµÄrsv-word²»Í¬µÄgmrÀ©Õ¹£¬
51 ҲʹÓÃÒ»¸öÁ´±í½á¹¹±£´æ£¬ÓÃÓÚmodulized rsv-word¶¨Òå¡£
52 # ÔÚÒ»¸örsv-wordµÄÓï·¨¶¨ÒåÖУ¬Ê¹ÓÃÆäËügmr¶¨Òå¡£
54 if_expr: T_IF T_DUAL_LPAREN expr T_DUAL_RPAREN T_LBRACE statement T_RBRACE
55 ÕâÀïµÄexprºÍstatementÊÇÆäËüÓï·¨¶¨ÒåmoduleÖж¨Òå²¢exportµÄ¡£½«gmr_exprÏñº¯Êý
56 Ò»Ñù¶¨ÒåÒ»¸ösymbol£¬²¢±£´æµ½Ò»¸öexport-tbl¡£ÔÚÆäËügmr_expr¶¨ÒåÖÐʹÓÃʱ£¬Ê¹ÓÃÕâ
57 ¸ösymbolµÄidxÖµ£¬»òÉèÖÃgmr_exprµ½ptr¡£
64 #############################################
66 #############################################
72 <regexpr> <proc>|<TOKEN_ID>
73 "<rsv-word>" <proc>|<TOKEN_ID>
74 "<opr-chars>" <proc>|<TOKEN_ID>
76 <regexpr> <proc>|<TOKEN_ID>
77 "<rsv-word>" <proc>|<TOKEN_ID>
78 "<opr-chars>" <proc>|<TOKEN_ID>