{"id":416,"date":"2013-12-24T12:01:33","date_gmt":"2013-12-24T03:01:33","guid":{"rendered":"http:\/\/owmya.com\/wordpress\/?p=416"},"modified":"2013-12-24T12:01:33","modified_gmt":"2013-12-24T03:01:33","slug":"esrap-peg-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b","status":"publish","type":"post","link":"https:\/\/owmya.com\/wordpress\/?p=416","title":{"rendered":"esrap-peg \u3092\u4f7f\u3063\u3066\u307f\u308b"},"content":{"rendered":"<p>\u3061\u3087\u3063\u3068\u3057\u305f\u30c4\u30fc\u30eb\u3092 Common Lisp \u3067\u8a66\u4f5c\u3059\u308b\u305f\u3081\u3001Parsing Expression Grammar \u30d1\u30fc\u30b5\u751f\u6210\u5668\u304c\u3042\u308b\u3068\u4fbf\u5229\u3060\u3063\u305f\u305f\u3081\u3001esarap-peg \u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5165\u308c\u3066\u307f\u305f\u3002\u305d\u306e\u969b\u306e\u899a\u66f8\u3002<\/p>\n<p><em>esrap-peg \u3092\u4f7f\u3046\u306b\u306f\u3001esrap \u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u3082\u308c\u306a\u304f\u5fc5\u8981\u3002<\/em><\/p>\n<h2>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>Quicklisp \u3092\u5165\u308c\u3066\u3042\u308c\u3070<\/p>\n<p style=\"padding-left: 30px;\">(ql:quickload &#8220;esrap-peg&#8221;)<\/p>\n<p>\u3068\u3059\u308c\u3070\u305d\u308c\u3067\u7d42\u308f\u308a\u3002\u5229\u7528\u306b\u969b\u3057\u3066\u306f\u3001<\/p>\n<p style=\"padding-left: 30px;\">(require &#8220;esrap-peg&#8221;)\u00a0\u00a0\u00a0 ;; require \u306b asdf \u304c\u7e54\u308a\u8fbc\u307e\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f (asdf:load-sytem :esrap-peg) \u306a\u3069\u9069\u5b9c<\/p>\n<p style=\"padding-left: 30px;\">;; \u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u3092\u3044\u3061\u3044\u3061\u6253\u3064\u306e\u304c\u9762\u5012\u306a\u3089<\/p>\n<p style=\"padding-left: 30px;\">(use-package &#8216;(:esrap-peg))<\/p>\n<p>\u3068\u3067\u3082\u3057\u3066\u304a\u3051\u3070\u3088\u3044\u3002<\/p>\n<h2>\u4f7f\u3044\u65b9<\/h2>\n<p>\u4f8b\u3048\u3070\u3001C \u8a00\u8a9e\u98a8\u306e\u6574\u6570\u5b9a\u6570\u8868\u73fe\u3092\u89e3\u91c8\u3059\u308b\u30d1\u30fc\u30b5(\u307e\u3042\u307b\u3068\u3093\u3069\u5b57\u53e5\u89e3\u6790)\u3092 PEG \u3067<\/p>\n<p style=\"padding-left: 30px;\">integer_constant &lt;- hexadecimal_integer_constant \/ octal_integer_constant \/ ecimal_integer_constant<\/p>\n<p style=\"padding-left: 30px;\">hexadecimal_integer_constant &lt;- ((&#8216;0&#8217; (&#8216;x&#8217; \/ &#8216;X&#8217;) [0-9a-fA-F]+) \/ ([0-9a-fA-F]+ (&#8216;h&#8217; \/ &#8216;H&#8217;))) integer_constant_postfix<\/p>\n<p style=\"padding-left: 30px;\">octal_integer_constant &lt;- &#8216;0&#8217; [0-7]+ integer_constant_postfix<\/p>\n<p style=\"padding-left: 30px;\">decimal_integer_constant &lt;- (&#8216;+&#8217; \/ &#8216;-&#8216;)? [0-9] [0-9]* integer_constant_postfix<\/p>\n<p style=\"padding-left: 30px;\">integer_constant_postfix &lt;- (&#8216;u&#8217; \/ &#8216;U&#8217;)? (&#8216;l&#8217; \/ &#8216;L&#8217;)?<\/p>\n<p>\u306a\u3069\u3068\u5b9a\u7fa9\u3057\u3066\u3001foo.peg \u30d5\u30a1\u30a4\u30eb\u306b\u3067\u3082\u7a81\u3063\u8fbc\u3093\u3067\u7f6e\u304f\u3002\u305d\u306e\u4e0a\u3067\u3001<\/p>\n<p style=\"padding-left: 30px;\">(esrap-peg:peg-compile (esrap-peg:parse-peg-file &#8220;foo.peg&#8221;))<\/p>\n<p style=\"padding-left: 30px;\">(esrap:parse &#8216;integer_constant &#8220;0x1f&#8221;)<\/p>\n<p style=\"padding-left: 60px;\">=&gt; (INTEGER_CONSTANT\u00a0(HEXADECIMAL_INTEGER_CONSTANT\u00a0((&#8220;0&#8221; &#8220;x&#8221; (&#8220;1&#8221; &#8220;f&#8221;)) (INTEGER_CONSTANT_POSTFIX (NIL NIL)))))<br \/>\nNIL<br \/>\nT<\/p>\n<p>\u3068\u304b\u306a\u3093\u3068\u304b\u3002\u8981\u3059\u308b\u306b<\/p>\n<ol>\n<li>esrap-peg:parse-peg-file \u3067 PEG \u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u3068\u76f8\u5fdc\u3059\u308b S \u5f0f\u306e\u6587\u6cd5\u5b9a\u7fa9\u304c\u5f97\u3089\u308c\u308b<\/li>\n<li>\u305d\u308c\u3092 esrap-peg:peg-compile \u306b\u98df\u308f\u305b\u308b\u3068\u76f8\u5fdc\u3059\u308b esrap:parse \u95a2\u6570\u304c\u51fa\u6765\u308b<\/li>\n<li>\u305d\u306e esrap:parse \u306b\u7b2c\u4e00\u5f15\u6570\u306b\u6587\u6cd5\u69cb\u6210\u8981\u7d20\u3001\u7b2c\u4e8c\u5f15\u6570\u306b\u30d1\u30fc\u30b9\u5bfe\u8c61\u6587\u5b57\u5217\u3092\u6e21\u3057\u3066\u547c\u3079\u3070\u3001\u30d1\u30fc\u30b9\u5bfe\u8c61\u304c\u6307\u5b9a\u3057\u305f\u6587\u6cd5\u306b\u5408\u81f4\u3059\u308b\u3082\u306e\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u89e3\u91c8\u3057\u3066\u304f\u308c\u308b<\/li>\n<\/ol>\n<p>\u5927\u7b4b\u306f\u4e0a\u306e\u3088\u3046\u306a\u611f\u3058\u3002\u5b9f\u969b\u306e\u3068\u3053\u308d\u306f\u3001\u69cb\u6587\u30a8\u30e9\u30fc\u306e\u5834\u5408\u306e\u30b3\u30f3\u30c7\u30a3\u30b7\u30e7\u30f3\u51e6\u7406\u3068\u304b\u3044\u308d\u3044\u308d\u3042\u308b\u308f\u3051\u3060\u3051\u308c\u3069\u3002<\/p>\n<p>\u6b63\u76f4\u3001esrap-peg \u5074\u306e\u8aac\u660e\u3060\u3051\u3060\u3068\u4f55\u3092\u3069\u3046\u3059\u308c\u3070\u826f\u3044\u306e\u304b\u5168\u7136\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u3002esrap \u5074\u306e\u8aac\u660e\u898b\u3066\u3001\u3084\u3063\u3068\u5408\u70b9\u304c\u3044\u3063\u305f\u6b21\u7b2c\u3002<\/p>\n<p>\u3042\u3068\u3001esrap-peg \u306b\u305b\u3088 esrap \u306b\u305b\u3088\u3001\u5229\u7528\u4f8b\u306a\u3069\u306e\u60c5\u5831\u304c\u30cd\u30c3\u30c8\u4e0a\u306b\u307b\u3068\u3093\u3069\u306a\u3044(\u30b0\u30fc\u30b0\u30eb\u5148\u751f\u306b\u8a0a\u306d\u3066\u3082\u6709\u7528\u306a\u56de\u7b54\u304c\u5f97\u3089\u308c\u306a\u3044)\u305f\u3081\u3001\u6848\u5916\u5229\u7528\u8005\u306f\u5c11\u306a\u3044\u306e\u304b\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3061\u3087\u3063\u3068\u3057\u305f\u30c4\u30fc\u30eb\u3092 Common Lisp \u3067\u8a66\u4f5c\u3059\u308b\u305f\u3081\u3001Parsing Expression Grammar \u30d1\u30fc\u30b5\u751f\u6210\u5668\u304c\u3042\u308b\u3068\u4fbf\u5229\u3060\u3063\u305f\u305f\u3081\u3001esarap-peg \u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5165\u308c\u3066\u307f\u305f\u3002\u305d\u306e\u969b\u306e\u899a\u66f8\u3002 esr &hellip; <a href=\"https:\/\/owmya.com\/wordpress\/?p=416\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[8,16],"tags":[17],"class_list":["post-416","post","type-post","status-publish","format-standard","hentry","category-8","category-16","tag-common-lisp"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=416"}],"version-history":[{"count":2,"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions"}],"predecessor-version":[{"id":418,"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions\/418"}],"wp:attachment":[{"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/owmya.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}