{"id":2985,"date":"2013-09-01T14:35:19","date_gmt":"2013-09-01T05:35:19","guid":{"rendered":"http:\/\/peta.okechan.net\/blog\/?p=2985"},"modified":"2013-09-01T14:35:19","modified_gmt":"2013-09-01T05:35:19","slug":"5-3-3-for%e3%83%ab%e3%83%bc%e3%83%97%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e6%a7%8b%e6%96%87%e8%a7%a3%e6%9e%90%e5%99%a8","status":"publish","type":"post","link":"https:\/\/peta.okechan.net\/blog\/archives\/2985","title":{"rendered":"5.3.3. for\u30eb\u30fc\u30d7\u306e\u305f\u3081\u306e\u69cb\u6587\u89e3\u6790\u5668"},"content":{"rendered":"<p><a href=\"https:\/\/peta.okechan.net\/blog\/archives\/2836\" title=\"LLVM\u306b\u3088\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b9f\u88c5\">LLVM\u306b\u3088\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b9f\u88c5\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u65e5\u672c\u8a9e\u8a33<\/a><br \/>\n\u7b2c5\u7ae0 \u4e07\u83ef\u93e1: \u8a00\u8a9e\u306e\u62e1\u5f35: \u5236\u5fa1\u30d5\u30ed\u30fc<br \/>\n<a href=\"http:\/\/llvm.org\/docs\/tutorial\/LangImpl05.html#parser-extensions-for-the-for-loop\" target=\"_blank\">\u7b2c3.3\u7bc0 for\u30eb\u30fc\u30d7\u306e\u305f\u3081\u306e\u69cb\u6587\u89e3\u6790\u5668<\/a><\/p>\n<p>\u69cb\u6587\u89e3\u6790\u5668\u306e\u30b3\u30fc\u30c9\u3082\u304b\u306a\u308a\u666e\u901a\u3067\u3042\u308b\u3002<br \/>\n\u3053\u3053\u3067\u552f\u4e00\u8208\u5473\u6df1\u3044\u306e\u306f\u3001\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3042\u308b\u30b9\u30c6\u30c3\u30d7\u5024\u306e\u51e6\u7406\u3067\u3042\u308b\u3002<br \/>\n\u3053\u306e\u69cb\u6587\u89e3\u6790\u5668\u306e\u30b3\u30fc\u30c9\u3067\u306f\u30012\u756a\u76ee\u306e\u30ab\u30f3\u30de\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u30b9\u30c6\u30c3\u30d7\u5024\u3092\u51e6\u7406\u3059\u308b\u3002<br \/>\n\u7701\u7565\u3055\u308c\u3066\u3044\u305f\u3089\u3001AST\u30ce\u30fc\u30c9\u306e\u4e2d\u3067\u30b9\u30c6\u30c3\u30d7\u5024\u306bnull\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\/\/\/ forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression\r\nstatic ExprAST *ParseForExpr() {\r\n  getNextToken();  \/\/ for\u3092\u6d88\u5316\u3002\r\n\r\n  if (CurTok != tok_identifier)\r\n    return Error(&quot;expected identifier after for&quot;);\r\n\r\n  std::string IdName = IdentifierStr;\r\n  getNextToken();  \/\/ \u8b58\u5225\u5b50\u3092\u6d88\u5316\u3002\r\n\r\n  if (CurTok != '=')\r\n    return Error(&quot;expected '=' after for&quot;);\r\n  getNextToken();  \/\/ '='\u3092\u6d88\u5316\u3002\r\n\r\n\r\n  ExprAST *Start = ParseExpression();\r\n  if (Start == 0) return 0;\r\n  if (CurTok != ',')\r\n    return Error(&quot;expected ',' after for start value&quot;);\r\n  getNextToken();\r\n\r\n  ExprAST *End = ParseExpression();\r\n  if (End == 0) return 0;\r\n\r\n  \/\/ \u30b9\u30c6\u30c3\u30d7\u5024\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3002\r\n  ExprAST *Step = 0;\r\n  if (CurTok == ',') {\r\n    getNextToken();\r\n    Step = ParseExpression();\r\n    if (Step == 0) return 0;\r\n  }\r\n\r\n  if (CurTok != tok_in)\r\n    return Error(&quot;expected 'in' after for&quot;);\r\n  getNextToken();  \/\/ in\u3092\u6d88\u5316\u3002\r\n\r\n  ExprAST *Body = ParseExpression();\r\n  if (Body == 0) return 0;\r\n\r\n  return new ForExprAST(IdName, Start, End, Step, Body);\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/peta.okechan.net\/blog\/archives\/2836\" title=\"LLVM\u306b\u3088\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b9f\u88c5\">LLVM\u306b\u3088\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b9f\u88c5\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u65e5\u672c\u8a9e\u8a33<\/a><br \/>\n\u7b2c5\u7ae0 \u4e07\u83ef\u93e1: \u8a00\u8a9e\u306e\u62e1\u5f35: \u5236\u5fa1\u30d5\u30ed\u30fc<br \/>\n<a href=\"http:\/\/llvm.org\/docs\/tutorial\/LangImpl05.html#parser-extensions-for-the-for-loop\" target=\"_blank\">\u7b2c3.3\u7bc0 for\u30eb\u30fc\u30d7\u306e\u305f\u3081\u306e\u69cb\u6587\u89e3\u6790\u5668<\/a><\/p>\n<p>\u69cb\u6587\u89e3\u6790\u5668\u306e\u30b3\u30fc\u30c9\u3082\u304b\u306a\u308a\u666e\u901a\u3067\u3042\u308b\u3002<br \/>\n\u3053\u3053\u3067\u552f\u4e00\u8208\u5473\u6df1\u3044\u306e\u306f\u3001\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3042\u308b\u30b9\u30c6\u30c3\u30d7\u5024\u306e\u51e6\u7406\u3067\u3042\u308b\u3002<br \/>\n\u3053\u306e\u69cb\u6587\u89e3\u6790\u5668\u306e\u30b3\u30fc\u30c9\u3067\u306f\u30012\u756a\u76ee\u306e\u30ab\u30f3\u30de\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u30b9\u30c6\u30c3\u30d7\u5024\u3092\u51e6\u7406\u3059\u308b\u3002<br \/>\n\u7701\u7565\u3055\u308c\u3066\u3044\u305f\u3089\u3001AST\u30ce\u30fc\u30c9\u306e\u4e2d\u3067\u30b9\u30c6\u30c3\u30d7\u5024\u306bnull\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\/\/\/ forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression\r\nstatic ExprAST *ParseForExpr() {\r\n  getNextToken();  \/\/ for\u3092\u6d88\u5316\u3002\r\n\r\n  if (CurTok != tok_identifier)\r\n    return Error(&quot;expected identifier after for&quot;);\r\n\r\n  std::string IdName = IdentifierStr;\r\n  getNextToken();  \/\/ \u8b58\u5225\u5b50\u3092\u6d88\u5316\u3002\r\n\r\n  if (CurTok != '=')\r\n    return Error(&quot;expected '=' after for&quot;);\r\n  getNextToken();  \/\/ '='\u3092\u6d88\u5316\u3002\r\n\r\n\r\n  ExprAST *Start = ParseExpression();\r\n  if (Start == 0) return 0;\r\n  if (CurTok != ',')\r\n    return Error(&quot;expected ',' after for start value&quot;);\r\n  getNextToken();\r\n\r\n  ExprAST *End = ParseExpression();\r\n  if (End == 0) return 0;\r\n\r\n  \/\/ \u30b9\u30c6\u30c3\u30d7\u5024\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3002\r\n  ExprAST *Step = 0;\r\n  if (CurTok == ',') {\r\n    getNextToken();\r\n    Step = ParseExpression();\r\n    if (Step == 0) return 0;\r\n  }\r\n\r\n  if (CurTok != tok_in)\r\n    return Error(&quot;expected 'in' after for&quot;);\r\n  getNextToken();  \/\/ in\u3092\u6d88\u5316\u3002\r\n\r\n  ExprAST *Body = ParseExpression();\r\n  if (Body == 0) return 0;\r\n\r\n  return new ForExprAST(IdName, Start, End, Step, Body);\r\n}<\/pre>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[466,467],"class_list":["post-2985","post","type-post","status-publish","format-standard","hentry","category-tech","tag-kaleidoscope","tag-llvm"],"_links":{"self":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/2985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/comments?post=2985"}],"version-history":[{"count":0,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/2985\/revisions"}],"wp:attachment":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media?parent=2985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/categories?post=2985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/tags?post=2985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}