{"id":341867,"date":"2022-11-28T21:00:05","date_gmt":"2022-11-28T21:00:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=341867"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=341867","title":{"rendered":"<span>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0432\u0435\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043d\u0430 \u043f\u043e\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0430\u0440\u0435\u043d\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e &#8212; \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0430\u043d\u043a\u0446\u0438\u0439 \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 arm \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0438 arm \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0432\u043e\u043e\u0431\u0449\u0435, \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u0435\u0440 \u043f\u043e <strong>\u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044e<\/strong>, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0443\u0436\u0435 \u043d\u0430 \u043e\u0442\u0435\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<p>\u0412\u044b\u0448\u0435 \u043f\u043e\u0434 \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0443 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c (\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 (\u044f\u0437\u044b\u043a\u0438 C, C++) \u0432\u0440\u044f\u0434 \u043b\u0438 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0435\u0433\u043b\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u043d\u0430 \u044f\u0434\u0440\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0439\u0448\u0435\u0433\u043e Linux, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u043a\u043e\u0434, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 <strong>\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442<\/strong>, \u0434\u0432\u043e\u0439\u043d\u044b\u0445 \u043d\u0438\u0436\u043d\u0438\u0445 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0439, \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u0438 \u0442.\u043f. \u0415\u0441\u043b\u0438 \u043a \u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u0438 \u043d\u0435\u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044f\u0437\u044b\u043a\u0430 C++, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u0435\u0442\u043e\u0434\u044b stoi(), stod(), empty(), \u0442\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435, \u043d\u0435 \u0442\u043e \u0447\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438, \u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0447\u0435\u0437\u043d\u0435\u0442.<\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435? \u0421 \u043f\u0440\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434. \u0412\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0443\u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c \u043a\u043e\u043c\u0430\u043d\u0434. \u0422\u0430\u043a\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (\u043a\u043e\u043c\u0430\u043d\u0434\u044b) \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u044d\u0442\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0431\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0431\u044b \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u043e\u0439, \u043d\u0435\u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439, \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0432 \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u0438 \u0442.\u0434. \u0422.\u0435. <strong>\u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/strong> \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u043e\u0441\u043b\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u0441 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u044b\u0448\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 &#8212; \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 LLVM. \u041e\u043d\u0430 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c.  \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u0447\u0435\u043c \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 LLVM \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 &#8212; C++).<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439, \u043b\u0438\u0448\u0435\u043d\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432. \u0418, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 <strong>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b (\u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f) \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430).<\/p>\n<h2>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435<\/h2>\n<p>\u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u041f\u0440\u0438 \u0447\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0438 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f?&#187;. \u0415\u0441\u043b\u0438 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u0422.\u0435. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u043b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0440\u0435\u0448\u0430\u043b \u044d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u041e\u0442\u0441\u044e\u0434\u0430 \u0431\u0435\u0440\u0443\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f &#8212; \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043a\u043e\u0431\u043a\u0438, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 (\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445), \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0445 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043d\u0438\u043c\u0438 \u0438 \u0442.\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0432\u044f\u0437\u044c \u043f\u0440\u044f\u043c\u0430\u044f, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e &#8212; \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f (\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430) \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0438 \u0440\u0435\u0448\u0438\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043d\u0430\u0431\u043e\u0440 \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043a\u0430\u0436\u0434\u0443\u044e \u043b\u0435\u043a\u0441\u0435\u043c\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, [literal: 1] [punctuator: +] [literal: 1] [punctuator: =] [literal: 2]).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/li>\n<\/ol>\n<p>\u0417\u0432\u0443\u0447\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<h2>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0442\u043e\u043a\u0435\u043d\u044b<\/h2>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0443\u0447\u0435\u0431\u043d\u044b\u0439, \u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u0446\u0435\u043b\u044b\u0435 \u0438 \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b +, -, *, \/ \u0438 \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043a\u043e\u0431\u043e\u043a. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (1.2 + 2) * 2.5.<\/p>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u0432\u0432\u0435\u0434\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430:<\/p>\n<pre><code class=\"cpp\">#include &lt;string> #include &lt;map> #include &lt;any> #include &lt;vector> #include \"..\/Ace.h\"  using namespace std;  namespace Lexer { struct Token { public: enum Kind { keyword, identifier, punctuator, literal };  Kind kind; any specifier; string value;  Token(Kind kind, any specifier, string value);  bool operator==(const Token &amp;other) const; string description();  optional&lt;Ace::Keyword> to_keyword(); optional&lt;Ace::Punctuator> to_punctuator(); optional&lt;Ace::Literal> to_literal();  private: string description(Kind kind);  template&lt;typename T> optional&lt;T> kind_cast(Kind kind) { if (this->kind != kind) { return {}; } else { return any_cast&lt;T>(specifier); } } }; }<\/code><\/pre>\n<pre><code class=\"cpp\">#include \"..\/..\/include\/Lexer\/Token.h\" #include \"..\/..\/include\/Ace.h\"  using namespace Lexer;  Token::Token(Kind kind, any specifier, string value) { this->kind = kind; this->specifier = specifier; this->value = move(value); }  bool Token::operator==(const Token &amp;other) const { bool is_kind_equal = kind == other.kind; bool is_specifier_equal; bool is_value_equal = value == other.value;  switch (kind) { case Kind::keyword: { auto lhs = any_cast&lt;Ace::Keyword>(specifier); auto rhs = any_cast&lt;Ace::Keyword>(other.specifier); is_specifier_equal = lhs == rhs; break; } case Kind::punctuator: { auto lhs = any_cast&lt;Ace::Punctuator>(specifier); auto rhs = any_cast&lt;Ace::Punctuator>(other.specifier); is_specifier_equal = lhs == rhs; break; } case Kind::literal: { auto lhs = any_cast&lt;Ace::Literal>(specifier); auto rhs = any_cast&lt;Ace::Literal>(other.specifier); is_specifier_equal = lhs == rhs; break; } case Kind::identifier: { is_specifier_equal = is_value_equal; break; } }  return is_kind_equal &amp;&amp; is_specifier_equal &amp;&amp; is_value_equal; }  string Token::description() { string kind_description = description(kind); string specifier_description;  switch (kind) { case Kind::keyword: { auto keyword = any_cast&lt;Ace::Keyword>(specifier); specifier_description = Ace::description(keyword); break; } case Kind::punctuator: { auto punctuator = any_cast&lt;Ace::Punctuator>(specifier); specifier_description = Ace::description(punctuator); break; } case Kind::literal: { auto literal = any_cast&lt;Ace::Literal>(specifier); specifier_description = Ace::description(literal); break; } case Kind::identifier: specifier_description = \"\"; break; }  return  \"Kind: \" + kind_description + \", \" + \"Specifier: \" + specifier_description + \", \" + \"Value: \" + value; }  optional&lt;Ace::Keyword> Token::to_keyword() { return kind_cast&lt;Ace::Keyword>(Kind::keyword); }  optional&lt;Ace::Punctuator> Token::to_punctuator() { return kind_cast&lt;Ace::Punctuator>(Kind::punctuator); }  optional&lt;Ace::Literal> Token::to_literal() { return kind_cast&lt;Ace::Literal>(Kind::literal); }  string Token::description(Kind kind) { switch (kind) { case Kind::keyword: return \"keyword\"; case Kind::punctuator: return \"punctuator\"; case Kind::literal: return \"literal\"; case Kind::identifier: return \"identifier\"; } }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0442\u043e\u043a\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u043a\u0430\u043a kind, specifier \u0438 value. \u042d\u0442\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0438\u043f, \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c \u0442\u0438\u043f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u0435\u043a\u0441\u0435\u043c\u044b.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u0435\u043d, \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0430 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u0442\u043e\u043a\u0435\u043d\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">#include &lt;optional> #include \"Token.h\" #include \"..\/Ace.h\"  using namespace std;  namespace Lexer { class Parser { public: vector&lt;Token> parse(const string &amp;source_code);  private: Token create_token(string lexem); bool is_literal(string lexem); bool is_identifier(string lexem); optional&lt;Ace::Literal> parse_literal(string lexem); optional&lt;string> parse_identifier(string lexem); }; }<\/code><\/pre>\n<pre><code class=\"cpp\">#include \"..\/..\/include\/Lexer\/Parser.h\" #include \"..\/..\/include\/lib\/StringManager.h\" #include \"..\/..\/include\/Literals\/Parser.h\" #include &lt;any>  using namespace Lexer;  vector&lt;Token> Parser::parse(const string &amp;source_code) { vector&lt;Token> tokens;  StringManager string_manager; auto predicate = [](char c) { return isspace(c); }; auto split_by_space = string_manager.split(source_code, predicate); vector&lt;string> components;  for (auto component : split_by_space) { auto predicate = [](char c) { auto str = string(1, c); return Ace::punctuators.contains(str); };  auto split_by_punctuator = string_manager.split(component, predicate, true);  for (auto subcomponent : split_by_punctuator) { components.push_back(subcomponent); } }  for (auto component : components) { Token token = create_token(component); tokens.push_back(token); }  return tokens; }  Token Parser::create_token(string lexem) { Token::Kind kind; any specifier;  if (Ace::keywords.contains(lexem)) { kind = Token::Kind::keyword; auto keyword = Ace::keywords[lexem]; specifier = keyword.value(); } else if (Ace::punctuators.contains(lexem)) { kind = Token::Kind::punctuator; auto punctuator = Ace::punctuators[lexem]; specifier = punctuator.value(); } else if (is_literal(lexem)) { kind = Token::Kind::literal; auto literal = parse_literal(lexem); specifier = literal.value(); } else if (is_identifier(lexem)) { kind = Token::Kind::identifier; auto identifier = parse_identifier(lexem); specifier = \"\"; }  return { kind, specifier, lexem }; }  bool Parser::is_literal(string lexem) { Literals::Parser parser; return parser.is_literal(lexem); }  bool Parser::is_identifier(string lexem) { \/\/ TODO: check identifier grammar return true; }  optional&lt;Ace::Literal> Parser::parse_literal(string lexem) { Literals::Parser parser; return parser.parse(lexem); }  optional&lt;string> Parser::parse_identifier(string lexem) { return lexem; }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u0432\u0438\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f string \u0438 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432. [1] \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c. \u041b\u0438\u0448\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a split() &#8212; \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 trim() \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0430 \u043a\u043e\u043d\u0446\u0430\u0445 \u0441\u0442\u0440\u043e\u043a\u0438. \u0410 \u0432\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u0446\u0435\u043b\u044b\u0445 \u0438 \u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0441\u0442\u0440\u043e\u043a, \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440 (1.2 + 2) * 2.5 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u0432 \u0442\u043e\u043a\u0435\u043d\u044b:<\/p>\n<ul>\n<li>\n<p>Kind: punctuator, Specifier: opening parenthesis, Value: (<\/p>\n<\/li>\n<li>\n<p>Kind: literal, Specifier: double, Value: 1.2<\/p>\n<\/li>\n<li>\n<p>Kind: punctuator, Specifier: plus, Value: +<\/p>\n<\/li>\n<li>\n<p>Kind: literal, Specifier: integer, Value: 2<\/p>\n<\/li>\n<li>\n<p>Kind: punctuator, Specifier: closing parenthesis, Value: )<\/p>\n<\/li>\n<li>\n<p>Kind: punctuator, Specifier: asterisk, Value: *<\/p>\n<\/li>\n<li>\n<p>Kind: literal, Specifier: double, Value: 2.5<\/p>\n<\/li>\n<\/ul>\n<h2>\u0421\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0431\u0440\u043e\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0430\u043c\u0431\u0440\u0430\u0437\u0443\u0440\u044b \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0443, \u0442.\u0435. \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u0437\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u0441\u043a\u043e\u0431\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u043b\u0438\u0431\u043e \u043a \u043b\u0435\u0432\u043e\u043c\u0443 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0443, \u043b\u0438\u0431\u043e \u043a \u043f\u0440\u0430\u0432\u043e\u043c\u0443). \u0418\u0442\u0430\u043a, \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b:<\/p>\n<p>Expression -> | Expression + A_Term<br \/>         | Expression &#8212; A_Term<br \/>             | A_Term<\/p>\n<p>A_Term -> | A_Term * B_Term<br \/>   | A_Term \/ B_Term<br \/>   | B_Term<\/p>\n<p>B_Term -> | (Expression)<br \/>   | C_Term<\/p>\n<p>C_Term -> 0\u20269<\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u043d\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b &#8212; \u044d\u0442\u043e Expression, A_Term, B_Term \u0438 C_Term, \u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 &#8212; \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u0430 \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0441\u043e \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0447\u0435\u043c \u043d\u0438\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u0442\u0435\u043c \u0432\u044b\u0448\u0435 \u0435\u0433\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a55\/1ed\/877\/a551ed877d3d558bfecd679e56e8007c.png\" width=\"1498\" height=\"1904\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a55\/1ed\/877\/a551ed877d3d558bfecd679e56e8007c.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0433\u0440\u0430\u0444 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043e\u0431\u0449\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044f\u0441\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0438\u0434\u0435\u044e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u0438\u0434\u0435\u044e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432. [2, 3]<\/p>\n<p>\u0414\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0443\u0437\u043b\u0443 \u0434\u0435\u0440\u0435\u0432\u0430. \u0418\u0437 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0443 \u0443\u0437\u043b\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0434\u043d\u0430 \u0432\u0435\u0442\u0432\u044c, \u043b\u0438\u0431\u043e \u0434\u0432\u0435 \u0432\u0435\u0442\u0432\u0438. \u0422\u0430\u043a\u0436\u0435 \u0443\u0437\u0435\u043b \u043c\u043e\u0436\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u043b\u0438\u0431\u043e \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430.<\/p>\n<pre><code class=\"cpp\">#include &lt;optional> #include \"..\/Ace.h\"  using namespace std;  namespace Expression { struct Node { enum class Kind { expression, a_term, b_term, c_term };  Kind kind; optional&lt;Ace::Operator> _operator; optional&lt;double> number; Node *left; Node *right; }; }<\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043f\u0440\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<pre><code class=\"cpp\">#include &lt;string> #include &lt;vector> #include &lt;map> #include \"Node.h\" #include \"..\/Lexer\/Parser.h\" #include &lt;list> #include \"..\/lib\/Array\/Array.h\"  using namespace std;  namespace Expression { class Parser { public: class Error: exception { public: enum class Reason { invalid_parenthesis, invalid_operand, invalid_operator };  const Reason reason;  explicit Error(Reason reason); const char * what() const noexcept override; };  Node* parse(vector&lt;Lexer::Token> &amp;tokens);  private: typedef Array&lt;Lexer::Token> Buffer;  Node* create_expression(Buffer buffer); Node* create_a_term(Buffer buffer); Node* create_b_term(Buffer buffer); Node* create_c_term(Buffer buffer); Buffer::iterator first_operator(Node::Kind non_terminal_kind, Buffer &amp;buffer); Buffer::iterator first_punctuator(Ace::Punctuator kind, Buffer &amp;buffer); Buffer::iterator last_punctuator(Ace::Punctuator kind, Buffer &amp;buffer); bool is_parenthesis_correct(Buffer buffer); bool is_operands_correct(Buffer buffer); bool is_operators_correct(Buffer buffer); }; }<\/code><\/pre>\n<pre><code class=\"cpp\">#include \"..\/..\/include\/Expression\/Parser.h\" #include &lt;iterator> #include &lt;set>  using namespace Expression;  Parser::Error::Error(Reason reason): reason(reason) {}  const char *Parser::Error::what() const noexcept { switch (reason) { case Error::Reason::invalid_parenthesis: return \"invalid parenthesis\"; case Error::Reason::invalid_operand: return \"invalid literal\"; case Error::Reason::invalid_operator: return \"invalid operator\"; } }  Node* Parser::parse(vector&lt;Lexer::Token> &amp;tokens) { Buffer buffer { tokens };  if (!is_parenthesis_correct(buffer)) { throw Error { Error::Reason::invalid_parenthesis }; }  if (!is_operands_correct(buffer)) { throw Error { Error::Reason::invalid_operand }; }  if (!is_operators_correct(buffer)) { throw Error { Error::Reason::invalid_operator }; }  return create_expression(buffer); }  Node* Parser::create_expression(Buffer buffer) { auto operator_iterator = first_operator(Node::Kind::expression, buffer);  if (operator_iterator == buffer.end()) { \/\/ Expression -> A_Term auto right_child = create_a_term(buffer); return new Node { Node::Kind::expression, right: right_child }; }  \/\/ Expression -> Expression + A_Term \/\/ Expression -> Expression - A_Term auto lhs_buffer = buffer.slice(buffer.begin(), operator_iterator); auto left_child = create_expression(lhs_buffer);  auto rhs_buffer = buffer.slice(operator_iterator + 1, buffer.end()); auto right_child = create_a_term(rhs_buffer);  auto token = *operator_iterator; auto punctuator = token.to_punctuator(); auto _operator = Ace::define_operator(punctuator.value());  return new Node { Node::Kind::expression, _operator: _operator.value(), left: left_child, right: right_child }; }  Node* Parser::create_a_term(Buffer buffer) { auto operator_iterator = first_operator(Node::Kind::a_term, buffer);  if (operator_iterator == buffer.end()) { \/\/ A_Term -> B_Term auto right_child = create_b_term(buffer); return new Node { Node::Kind::a_term, right: right_child }; }  \/\/ A_Term -> A_Term * B_Term \/\/ A_Term -> A_Term \/ B_Term auto lhs_buffer = buffer.slice(buffer.begin(), operator_iterator); auto left_child = create_a_term(lhs_buffer);  auto rhs_buffer = buffer.slice(operator_iterator + 1, buffer.end()); auto right_child = create_b_term(rhs_buffer);  auto token = *operator_iterator; auto punctuator = token.to_punctuator(); auto _operator = Ace::define_operator(punctuator.value());  return new Node { Node::Kind::a_term, _operator: _operator.value(), left: left_child, right: right_child }; }  Node* Parser::create_b_term(Buffer buffer) { auto opening_parenthesis = first_punctuator(Ace::Punctuator::opening_parenthesis, buffer);  if (opening_parenthesis == buffer.end()) { \/\/ B_Term -> C_Term auto right_child = create_c_term(buffer); return new Node { Node::Kind::b_term, right: right_child }; }  auto closing_parenthesis = last_punctuator(Ace::Punctuator::closing_parenthesis, buffer);  \/\/ B_Term -> (Expression) auto _buffer = buffer.slice(opening_parenthesis + 1, closing_parenthesis); auto right_child = create_expression(_buffer);  return new Node { Node::Kind::b_term, right: right_child }; }  Node* Parser::create_c_term(Buffer buffer) { \/\/ C_Term -> 0...9 if (buffer.is_empty()) { throw Error { Error::Reason::invalid_operator }; }  auto token = buffer[0]; auto value = stod(token.value); return new Node { Node::Kind::c_term, number: value }; }  Parser::Buffer::iterator Parser::first_operator(Node::Kind non_terminal_kind, Buffer &amp;buffer) { auto is_non_terminal_operator = [&amp;](Ace::Operator _operator) { switch (non_terminal_kind) { case Node::Kind::expression: { auto is_addition = _operator == Ace::Operator::addition; auto is_subtraction = _operator == Ace::Operator::subtraction; return is_addition || is_subtraction; } case Node::Kind::a_term: { auto is_multiplication = _operator == Ace::Operator::multiplication; auto is_division = _operator == Ace::Operator::division; return is_multiplication || is_division; } default: { return false; } } };  Buffer::iterator result = buffer.end(); int parenthesis_count = 0;  for (auto iterator = buffer.begin(); iterator != buffer.end(); iterator++) { auto token = *iterator; auto punctuator = token.to_punctuator();  if (!punctuator.has_value()) { continue; }  if (punctuator == Ace::Punctuator::opening_parenthesis) { parenthesis_count += 1; continue; }  if (punctuator == Ace::Punctuator::closing_parenthesis) { parenthesis_count -= 1; continue; }  if (parenthesis_count > 0) { continue; }  auto _operator = Ace::define_operator(punctuator.value());  if (!_operator.has_value()) { continue; }  if (is_non_terminal_operator(_operator.value())) { result = iterator; } }  return result; }  Parser::Buffer::iterator Parser::first_punctuator(Ace::Punctuator kind, Buffer &amp;buffer) { Buffer::iterator result = buffer.end();  for (auto iterator = buffer.begin(); iterator != buffer.end(); iterator++) { auto token = *iterator; auto punctuator = token.to_punctuator();  if (!punctuator.has_value()) { continue; }  if (punctuator.value() == kind) { result = iterator; break; } }  return result; }  Parser::Buffer::iterator Parser::last_punctuator(Ace::Punctuator kind, Buffer &amp;buffer) { Buffer::iterator result = buffer.end();  for (auto iterator = buffer.begin(); iterator != buffer.end(); iterator++) { auto token = *iterator; auto punctuator = token.to_punctuator();  if (!punctuator.has_value()) { continue; }  if (punctuator.value() == kind) { result = iterator; } }  return result; }  bool Parser::is_parenthesis_correct(Buffer buffer) { int opening_parenthesis_count = 0; int closing_parenthesis_count = 0;  for (auto iterator = buffer.begin(); iterator != buffer.end(); iterator++) { auto token = *iterator; auto punctuator = token.to_punctuator();  if (!punctuator.has_value()) { continue; }  if (punctuator == Ace::Punctuator::opening_parenthesis) { opening_parenthesis_count += 1; continue; }  if (punctuator == Ace::Punctuator::closing_parenthesis) { closing_parenthesis_count += 1; continue; } }  return opening_parenthesis_count == closing_parenthesis_count; }  bool Parser::is_operands_correct(Expression::Parser::Buffer buffer) { bool is_correct = true;  set&lt;Lexer::Token::Kind> allowed_tokens { Lexer::Token::Kind::literal, Lexer::Token::Kind::punctuator };  for (auto iterator = buffer.begin(); iterator != buffer.end(); iterator++) { auto token = *iterator;  if (!allowed_tokens.contains(token.kind)) { is_correct = false; break; }  auto literal = token.to_literal();  if (!literal.has_value()) { continue; }  switch (literal.value()) { case Ace::Literal::integer: case Ace::Literal::_double: continue; default: is_correct = false; break; }  break; }  return is_correct; }  bool Parser::is_operators_correct(Expression::Parser::Buffer buffer) { bool is_correct = true;  set&lt;Ace::Punctuator> allowed_punctuators { Ace::Punctuator::opening_parenthesis, Ace::Punctuator::closing_parenthesis };  for (auto iterator = buffer.begin(); iterator != buffer.end(); iterator++) { auto token = *iterator; auto punctuator = token.to_punctuator();  if (!punctuator.has_value()) { continue; }  if (allowed_punctuators.contains(punctuator.value())) { continue; }  auto _operator = Ace::define_operator(punctuator.value());  if (!_operator.has_value()) { is_correct = false; break; } }  return is_correct; }<\/code><\/pre>\n<h2>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/h2>\n<p>\u041d\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u0443\u0437\u043b\u0430 \u0438, \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044f\u0441\u044c \u0432\u0432\u0435\u0440\u0445, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0443\u0437\u043b\u043e\u0432.<\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 &#8212; \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0437\u0435\u043b (root) \u0434\u0435\u0440\u0435\u0432\u0430, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u043c.<\/p>\n<pre><code class=\"cpp\">#include \"..\/Expression\/Node.h\"  class Interpretator { public: class Error: exception { public: enum class Reason { division_by_zero };  const Reason reason;  explicit Error(Reason reason); const char * what() const noexcept override; };  double calculate(Expression::Node *node); };<\/code><\/pre>\n<pre><code class=\"cpp\">#include \"..\/..\/include\/Interpretator\/Interpretator.h\" #include \"..\/..\/include\/Ace.h\"  Interpretator::Error::Error(Interpretator::Error::Reason reason) : reason(reason) {}  const char * Interpretator::Error::what() const noexcept { switch (reason) { case Reason::division_by_zero: return \"Division by zero\"; } }  double Interpretator::calculate(Expression::Node *node) { if (node->number.has_value()) { return node->number.value(); } else if (node->_operator.has_value()) { auto _operator = node->_operator.value(); auto lhs = calculate(node->left); auto rhs = calculate(node->right);  switch (_operator) { case Ace::Operator::addition: return lhs + rhs; case Ace::Operator::subtraction: return lhs - rhs; case Ace::Operator::multiplication: return lhs * rhs; case Ace::Operator::division: if (rhs == 0) { throw Error { Error::Reason::division_by_zero }; }  return lhs \/ rhs; } } else { return calculate(node->right); } }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u043d\u0430 \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 &#8212; \u044d\u0442\u043e \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0435\u043e\u0440\u0438\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430\u043c\u0438 \u0432 \u0434\u0430\u043b\u0435\u043a\u0438\u0435 50-\u0435. [2, 3]  \u0410\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 SOLID \u0441 \u0443\u043f\u043e\u0440\u043e\u043c \u043d\u0430 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430. [4, 5] \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 [1] \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438.<\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ol>\n<li>\n<p><a href=\"https:\/\/github.com\/AceRodstin\/Calculator\" rel=\"noopener noreferrer nofollow\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.amazon.com\/Advanced-Programming-Language-Design-Raphael\/dp\/0805311912\" rel=\"noopener noreferrer nofollow\">Advanced Programming Language Design<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.amazon.com\/Compilers-Principles-Techniques-Tools-2nd\/dp\/0321486811\" rel=\"noopener noreferrer nofollow\">Compilers Principles Techniques and Tools (2nd Edition)<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.oreilly.com\/library\/view\/code-complete-2nd\/0735619670\/\" rel=\"noopener noreferrer nofollow\">Code Complete, 2nd Edition<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.amazon.com\/Clean-Code-Handbook-Software-Craftsmanship\/dp\/0132350882\" rel=\"noopener noreferrer nofollow\">Clean Code: A Handbook of Agile Software Craftsmanship<\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/702142\/\"> https:\/\/habr.com\/ru\/post\/702142\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0432\u0435\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043d\u0430 \u043f\u043e\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0430\u0440\u0435\u043d\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e &#8212; \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0430\u043d\u043a\u0446\u0438\u0439 \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 arm \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0438 arm \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0432\u043e\u043e\u0431\u0449\u0435, \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u0435\u0440 \u043f\u043e <strong>\u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044e<\/strong>, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0443\u0436\u0435 \u043d\u0430 \u043e\u0442\u0435\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<p>\u0412\u044b\u0448\u0435 \u043f\u043e\u0434 \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0443 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c (\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 (\u044f\u0437\u044b\u043a\u0438 C, C++) \u0432\u0440\u044f\u0434 \u043b\u0438 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0435\u0433\u043b\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u043d\u0430 \u044f\u0434\u0440\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0439\u0448\u0435\u0433\u043e Linux, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u043a\u043e\u0434, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 <strong>\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442<\/strong>, \u0434\u0432\u043e\u0439\u043d\u044b\u0445 \u043d\u0438\u0436\u043d\u0438\u0445 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0439, \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u0438 \u0442.\u043f. \u0415\u0441\u043b\u0438 \u043a \u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u0438 \u043d\u0435\u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044f\u0437\u044b\u043a\u0430 C++, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u0435\u0442\u043e\u0434\u044b stoi(), stod(), empty(), \u0442\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435, \u043d\u0435 \u0442\u043e \u0447\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438, \u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0447\u0435\u0437\u043d\u0435\u0442.<\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435? \u0421 \u043f\u0440\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434. \u0412\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0443\u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c \u043a\u043e\u043c\u0430\u043d\u0434. \u0422\u0430\u043a\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (\u043a\u043e\u043c\u0430\u043d\u0434\u044b) \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u044d\u0442\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0431\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0431\u044b \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u043e\u0439, \u043d\u0435\u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439, \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0432 \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u0438 \u0442.\u0434. \u0422.\u0435. <strong>\u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/strong> \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u043e\u0441\u043b\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u0441 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u044b\u0448\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 &#8212; \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 LLVM. \u041e\u043d\u0430 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c.  \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u0447\u0435\u043c \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 LLVM \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 &#8212; C++).<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439, \u043b\u0438\u0448\u0435\u043d\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432. \u0418, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 <strong>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b (\u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f) \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430).<\/p>\n<h2>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435<\/h2>\n<p>\u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u041f\u0440\u0438 \u0447\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0438 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f?&#187;. \u0415\u0441\u043b\u0438 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u0422.\u0435. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u043b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0440\u0435\u0448\u0430\u043b \u044d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u041e\u0442\u0441\u044e\u0434\u0430 \u0431\u0435\u0440\u0443\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f &#8212; \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043a\u043e\u0431\u043a\u0438, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 (\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445), \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0445 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043d\u0438\u043c\u0438 \u0438 \u0442.\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0432\u044f\u0437\u044c \u043f\u0440\u044f\u043c\u0430\u044f, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e &#8212; \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f (\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430) \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0438 \u0440\u0435\u0448\u0438\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043d\u0430\u0431\u043e\u0440 \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043a\u0430\u0436\u0434\u0443\u044e \u043b\u0435\u043a\u0441\u0435\u043c\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, [literal: 1] [punctuator: +] [literal: 1] [punctuator: =] [literal: 2]).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/li>\n<\/ol>\n<p>\u0417\u0432\u0443\u0447\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<h2>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0442\u043e\u043a\u0435\u043d\u044b<\/h2>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0443\u0447\u0435\u0431\u043d\u044b\u0439, \u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u0446\u0435\u043b\u044b\u0435 \u0438 \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b +, -, *, \/ \u0438 \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043a\u043e\u0431\u043e\u043a. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (1.2 + 2) * 2.5.<\/p>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u0432\u0432\u0435\u0434\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430:<\/p>\n<pre><code class=\"cpp\">#include &lt;string> #include &lt;map> #include &lt;any> #include &lt;vector> #include \"..\/Ace.h\"  using namespace std;  namespace Lexer { struct Token { public: enum Kind { keyword, identifier, punctuator, literal };  Kind kind; any specifier; string value;  Token(Kind kind, any specifier, string value);  bool operator==(const Token &amp;other) const; string description();  optional&lt;Ace::Keyword> to_keyword(); optional&lt;Ace::Punctuator> to_punctuator(); optional&lt;Ace::Literal> to_literal();  private: string description(Kind kind);  template&lt;typename T> optional&lt;T> kind_cast(Kind kind) { if (this->kind != kind) { return {}; } else { return any_cast&lt;T>(specifier); } } }; }<\/code><\/pre>\n<pre><code class=\"cpp\">#include \"..\/..\/include\/Lexer\/Token.h\" #include \"..\/..\/include\/Ace.h\"  using namespace Lexer;  Token::Token(Kind kind, any specifier, string value) { this->kind = kind; this->specifier = specifier; this->value = move(value); }  bool Token::operator==(const Token &amp;other) const { bool is_kind_equal = kind == other.kind; bool is_specifier_equal; bool is_value_equal = value == other.value;  switch (kind) { case Kind::keyword: { auto lhs = any_cast&lt;Ace::Keyword>(specifier); auto rhs = any_cast&lt;Ace::Keyword>(other.specifier); is_specifier_equal = lhs == rhs; break; } case Kind::punctuator: { auto lhs = any_cast&lt;Ace::Punctuator>(specifier); auto rhs = any_cast&lt;Ace::Punctuator>(other.specifier); is_specifier_equal = lhs == rhs; break; } case Kind::literal: { auto lhs = any_cast&lt;Ace::Literal>(specifier); auto rhs = any_cast&lt;Ace::Literal>(other.specifier); is_specifier_equal = lhs == rhs; break; } case Kind::identifier: { is_specifier_equal = is_value_equal; break; } }  return is_kind_equal &amp;&amp; is_specifier_equal &amp;&amp; is_value_equal; }  string Token::description() { string kind_description = description(kind); string specifier_description;  switch (kind) { case Kind::keyword: { auto keyword = any_cast&lt;Ace::Keyword>(specifier); specifier_description = Ace::description(keyword); break; } case Kind::punctuator: { auto punctuator = any_cast&lt;Ace::Punctuator>(specifier); specifier_description = Ace::description(punctuator); break; } case Kind::literal: { auto literal = any_cast&lt;Ace::Literal>(specifier); specifier_description = Ace::description(literal); break; } case Kind::identifier: specifier_description = \"\"; break; }  return  \"Kind: \" + kind_description + \", \" + \"Specifier: \" + specifier_description + \", \" + \"Value: \" + value; }  optional&lt;Ace::Keyword> Token::to_keyword() { return kind_cast&lt;Ace::Keyword>(Kind::keyword); }  optional&lt;Ace::Punctuator> Token::to_punctuator() { return kind_cast&lt;Ace::Punctuator>(Kind::punctuator); }  optional&lt;Ace::Literal> Token::to_literal() { return kind_cast&lt;Ace::Literal>(Kind::literal); }  string Token::description(Kind kind) { switch (kind) { case Kind::keyword: return \"keyword\"; case Kind::punctuator: return \"punctuator\"; case Kind::literal: return \"literal\"; case Kind::identifier: return \"identifier\"; } }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0442\u043e\u043a\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u043a\u0430\u043a kind, specifier \u0438 value. \u042d\u0442\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0438\u043f, \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c \u0442\u0438\u043f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u0435\u043a\u0441\u0435\u043c\u044b.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u0435\u043d, \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0430 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u0442\u043e\u043a\u0435\u043d\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">#include &lt;optional> #include \"Token.h\" #include \"..\/Ace.h\"  using namespace std;  namespace Lexer { class Parser { public: vector&lt;Token> parse(const string &amp;source_code);  private: Token create_token(string lexem); bool is_literal(string lexem); bool is_identifier(string lexem); optional&lt;Ace::Literal> parse_literal(string lexem); optional&lt;string> parse_identifier(string lexem); }; }<\/code><\/pre>\n<pre><code class=\"cpp\">#include \"..\/..\/include\/Lexer\/Parser.h\" #include \"..\/..\/include\/lib\/StringManager.h\" #include \"..\/..\/include\/Literals\/Parser.h\" #include &lt;any>  using namespace Lexer;  vector&lt;Token> Parser::parse(const string &amp;source_code) { vector&lt;Token> tokens;  StringManager string_manager; auto predicate = [](char c) { return isspace(c); }; auto split_by_space = string_manager.split(source_code, predicate); vector&lt;string> components;  for (auto component : split_by_space) { auto predicate = [](char c) { auto str = string(1, c); return Ace::punctuators.contains(str); };  auto split_by_punctuator = string_manager.split(component, predicate, true);  for (auto subcomponent : split_by_punctuator) { components.push_back(subcomponent); } }  for (auto component : components) { Token token = create_token(component); tokens.push_back(token); }  return tokens; }  Token Parser::create_token(string lexem) { Token::Kind kind; any specifier;  if (Ace::keywords.contains(lexem)) { kind = Token::Kind::keyword; auto keyword = Ace::keywords[lexem]; specifier = keyword.value(); } else if (Ace::punctuators.contains(lexem)) { kind = Token::Kind::punctuator; auto punctuator = Ace::punctuators[lexem]; specifier = punctuator.value(); } else if (is_literal(lexem)) { kind = Token::Kind::literal; auto literal = parse_literal(lexem); specifier = literal.value(); } else if (is_identifier(lexem)) { kind = Token::Kind::identifier; auto identifier = parse_identifier(lexem); specifier = \"\"; }  return { kind, specifier, lexem }; }  bool Parser::is_literal(string lexem) { Literals::Parser parser; return parser.is_literal(lexem); }  bool Parser::is_identifier(string lexem) { \/\/ TODO: check identifier grammar return true; }  optional&lt;Ace::Literal> Parser::parse_literal(string lexem) { Literals::Parser parser; return parser.parse(lexem); }  optional&lt;string> Parser::parse_identifier(string lexem) { return lexem; }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u0432\u0438\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f string \u0438 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432. [1] \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c. \u041b\u0438\u0448\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a split() &#8212; \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 trim() \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0430 \u043a\u043e\u043d\u0446\u0430\u0445 \u0441\u0442\u0440\u043e\u043a\u0438. \u0410 \u0432\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u0446\u0435\u043b\u044b\u0445 \u0438 \u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0441\u0442\u0440\u043e\u043a, \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440 (1.2 + 2) * 2.5 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u0432 \u0442\u043e\u043a\u0435\u043d\u044b:<\/p>\n<ul>\n<li>\n<p>Kind: punctuator, Specifier: opening parenthesis, Value: (<\/p>\n<\/li>\n<li>\n<p>Kind: literal, Specifier: double, Value: 1.2<\/p>\n<\/li>\n<li>\n<p>Kind: punctuator, Specifier:<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-341867","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=341867"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341867\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=341867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=341867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=341867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}