ToDo:
http://www.amazon.co.jp/exec/obidos/ASIN/4198607028/503-4855349-7085504
²Ê³Ø¤À¤±¤¬ËÜÅö¤ËÍ£°ì¡¢¿¿Íý¤Ë¥¢¥¯¥»¥¹¤Ç¤¤ëÊýË¡¤Ê¤Î¤À¤í¤¦¤«¡ÄÃÎÀ¤ÎËܼÁ¤òµá¤á¤Æ ¡Ö¥×¥é¥È¥óŪÀ¤³¦¡×=¡ÖÀº¿À¤Î¶õ´Ö¡×¤Ø·èÁ³¤È¤·¤ÆƧ¤ßÆþ¤Ã¤¿Å·ºÍ¥¸¥ç¥»¥Õ¥½¥ó¤ÎÉõ°õ¤µ ¤ì¤¿²Ê³ØŪ¸¦µæ¤ÎÂÀפòé¤ë¡½¡£¥µ¥¤¥³¥¥Í¥¹¡¦¥Æ¥ì¥Ñ¥·¡¼¡¦±ó³ÖÆ©»ë¤«¤é²»³Ú¤Îµ¯¸» ¤Ë»ê¤ë¤Þ¤Ç¡¢Ì¤²òÌÀ¸½¾Ý¤ÎÆæ¤ËÎ̻ҤÇÇ÷¤ë¡È¶ØÃǤ覵æ¡É30ǯ´Ö¤ÎÀ®²Ì¡½¡£
¤¹¤²¡¼¡¼¡¼
(06:49)
¤Ê¤ó¤«½ÅÎÏÄ´Àá¤Î¥²¡¼¥à¤ÈÏ»³Ñ·Á¤Î¥ä¥Ä¡£
¸«¤¿Ìܤ˽ÅÎϤÎÊý¤¬ÌÌÇò¤½¤¦¤À¤Ã¤¿¤Î¤Ç¤½¤Ã¤Á¤ò¤ä¤ë¡£ ¤Þ¤¡ÌÌÇò¤¤¡£ AB¥Ü¥¿¥ó¤À¤±¤Ç2¼¡¸µ¶õ´Ö¤ò°ÜÆ°¤¹¤ë ¥²¡¼¥à¤Ë¤Á¤ã¤ó¤È¤Ê¤Ã¤Æ¤ë¤Î¤Ï¤¿¤¤¤·¤¿¤â¤ó¤«¤Ê¤¡¡£ ¤Þ¤¡¼ÂºÝÌÌÇò¤¤¤ó¤À¤±¤É¡¢¤ï¤ê¤ÈÂà¶þ¤Ç¡¢ ¥«¥¿¥ë¥·¥¹¤È¤«¤¢¤ó¤Þ̵¤¤¡£ ¤Þ¤¡¤Ê¤ë¤Û¤É¤Á¤ã¤ó¤È¤Ç¤¤Æ¤ë¤Í¤§¡¢¤È¤¤¤¦´¶¤¸¤Ç¡¢ ¤¢¡¼¤½¤ì°Ê¾å¤Ç¤â¤½¤ì°Ê²¼¤Ç¤â¤Ê¤¯¤Æ¡¢ ´ë²èÄ̤ꡢ»î¤ß¤È¤·¤Æ¤ÏÌÌÇò¤¤¤Ã¤Æ¤¤¤¦¤Î¤Ï¤ï¤«¤ë¤·¡¢ ¤³¤¦¤¤¤¦¤³¤È¤Ç¤¤ëǤŷƲ¤¹¤²¡¼¤È¤Ï»×¤¦¤ó¤À¤±¤É¡¢ ¥²¡¼¥à¤ÎËܼÁ¤Ï¥³¥³¤Ë¥¢¥ê¡¢¤ß¤¿¤¤¤Ê¤Î¤Ï¤Þ¤¡°ã¤¦¤À¤í¤¦¤È¡£
¤½¤ó¤ÇÏ»³Ñ·Á¤ÎÊý¤ÏÌÌÇò¤¯¤Ê¤¤¥Ñ¥º¥ë¤À¤Ã¤¿¡£ ¤Þ¤¡¤³¤ì¤Ï¤Þ¤¡Èù̯¤È¤«¤ò±Û¤¨¤ÆÉáÄ̤ËÌÌÇò¤¯¤Ê¤¤¡£ ¥Ñ¥º¥ë¥²¡¼¥à¤Ã¤Æ¤Þ¤¡¥ë¡¼¥ë¤Ï̵¿ô¤Ë¹Í¤¨¤é¤ì¤Æ¡¢ ¿¼¤ß¤Ë¤Ï¤½¤ì¤Û¤É¤Îº¹¤Ï̵¤¤¤ó¤À¤í¤¦¤±¤É¡¢ ¤³¤¦¡¢¤À¤«¤é¤³¤½¡¢¤ï¤«¤ê¤ä¤¹¤¤¥«¥¿¥ë¥·¥¹¤¬ ɬÍפʤó¤À¤í¤¦¤Ê¤¡¤È¡£ ¥Æ¥È¥ê¥¹¤Ï²¿¤òÌܻؤ¹¤«¤¬½½Ê¬¤ï¤«¤ê¤ä¤¹¤¤¤·¡¢ ¤×¤è¤×¤è¤ÏÏ¢º¿¤ÇÁÖ²÷¡ù¤ß¤¿¤¤¤Ê´¶¤¸¤À¤·¡¢ ¥Ñ¥Í¥Ý¥ó¤Ï¤Þ¤¡¥¢¥¯¥·¥ç¥óÏ¢º¿¤È¤«¸«¤ë¤«¤é¤Ë³Ú¤·¤¤¤·¡¢ ¤¢¤È¥á¥Æ¥ª¥¹¤È¤«¤â¤Ê¤ó¤«¤³¤¦µ¤»ý¤ÁÎɤµ¤ß¤¿¤¤¤Ê¤Î¤Ï ¤¢¤ë¤ó¤À¤í¤¦¤¿¤Ö¤ó¤ß¤¿¤¤¤Ê¡£ ¤½¤¦¤¤¤¦¤Î¤¬Ìµ¤¤°Ê¾å¡¢Ï»³Ñ·Á¤Î¤Ï¥Ñ¥º¥ë¥²¡¼¥à¤È¤·¤Æ ¥ë¡¼¥ë¤¬ÂÅÅö¤«¤É¤¦¤«¤È¤«È½ÃǤ¹¤ë¼¡¸µ¤Ë¤¹¤é㤻¤Ê¤¤¤È¤¤¤¦¤«¡£
¥±¡¼¥¿¥¤¤È¤«¤Î¥²¡¼¥à¤È¤·¤Æ¤Ê¤é ¤¤¤¤µ¤¤¬¤¹¤ë¤ó¤À¤±¤ì¤É¤â¡¢ ¥²¡¼¥àµ¡¤Î¥²¡¼¥à¤È¤·¤Æ¤Ï¤ä¤Ï¤ê¤³¤¦ÊªÂ¤ê¤Ê¤¤·Ï¤Ê¡£
¤¢¡¼¤Ç¤â¤Ê¤ó¤«¡¢º£»þ¤Î¥²¡¼¥à¤Î±é½Ð¤Ë´·¤ì¤¿¥¦¥Á¤é¤Ï ÀΤÎÇöÌ£¤Ç¤Ï¤Û¤²¤Û¤²¤Ç¤¤ó¤Î¤Ç¤¹¤è¡¢¤ß¤¿¤¤¤Ê¡¢ ¤¨¤¨¤ÈÀ»³Ø¤Ç¤ÏµÕ¤À¤Ã¤¿µ¤¤â¤¹¤ë¤±¤É¡¢ ¤É¤¦¤Ç¤â¤¤¤¤¤ä¡£ ¤Ä¤Þ¤ê¤½¤¦¤¤¤¦¾õÂ֤ˤʤäƤë¤È¤¹¤ì¤Ð ËͤÎÊý¤ËÌäÂ꤬¤¢¤ë¤È¤â¹Í¤¨¤é¤ì¤ë¤·¡¢ ¤Þ¤¡¼ÂºÝÀÎÇ®Ã椷¤¿¥²¡¼¥à¥¦¥©¥Ã¥Á¤È¤« º£¤¸¤ãÀäÂФǤ¤ó¤·¡¢ ·ëÏÀ¤Ï¤Þ¤¡¤è¤¯¤¢¤ëÏäÀ¤±¤É¡¢ ¤Þ¤¡Ì²¤¤¤Ê¤¡¤È¡£
¤¢¤È¤Ê¤¼¤«¥¢¥´¤¬Äˤ¤¡£¤Ê¤¼¡©
(13:40)
i@u ~/wrk/bf> ghci sbf.hs ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.4.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base-1.0 ... linking ... done. Compiling Main ( sbf.hs, interpreted ) Ok, modules loaded: Main. *Main> test sexpr "(a b (c (d) e) f)" Loading package parsec-1.0 ... linking ... done. [a,b,[c,[d],e],f]
Æ°¤¤¤¿¤ï¡¼
import Text.ParserCombinators.Parsec import qualified Text.ParserCombinators.Parsec.Token as P import Text.ParserCombinators.Parsec.Language import Text.ParserCombinators.Parsec.Expr sbfStyle = emptyDef { commentStart = "" , commentEnd = "" , commentLine = ";" , nestedComments = False , identStart = identLetter sbfStyle , identLetter = alphaNum <|> oneOf "_':!#$%&*+./<=>?@\\^|-~" , opStart = oneOf "" , opLetter = oneOf "" , reservedOpNames = [] , reservedNames = [] , caseSensitive = True } lexer = P.makeTokenParser(sbfStyle) whiteSpace = P.whiteSpace lexer lexeme = P.lexeme lexer symbol = P.symbol lexer natural = P.natural lexer parens = P.parens lexer semi = P.semi lexer identifier = P.identifier lexer reserved = P.reserved lexer reservedOp = P.reservedOp lexer data Sexpr = IntConst Integer | Ident String | Expr [Sexpr] instance Show Sexpr where show (IntConst i) = show i show (Ident i) = i show (Expr e) = show e expr = many sexpr >>= return . Expr sexpr = parens (expr >>= return) <|> (identifier >>= return . Ident) test p s = case parse p "" s of Left err -> print err Right n -> print n
(19:17)
Á° | 2006ǯ 6·î |
¼¡ | ||||
Æü | ·î | ²Ð | ¿å | ÌÚ | ¶â | ÅÚ |
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£