{"id":307319,"date":"2020-07-22T15:00:30","date_gmt":"2020-07-22T15:00:30","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307319"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307319","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 DSL \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/512058\/\"><b><i>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0421\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u043d\u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0443\u0440\u0441\u0430 \u043e\u0442 OTUS <a href=\"https:\/\/otus.pw\/5htZ\/\">\u00abBackend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430 Kotlin\u00bb<\/a>. \u0412 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430.<\/i><\/b><\/p>\n<hr>\n<p>  \u0427\u0430\u0441\u0442\u043e \u043f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0437\u0440\u0435\u043d\u0438\u0435\u043c, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u042d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u0441\u0435\u0442\u044f\u043c\u0438.<a name=\"habracut\"><\/a><\/p>\n<p>  \u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0434\u043e\u0440\u043e\u0432\u043e, \u0431\u0443\u0434\u044c \u0443 \u043d\u0430\u0441 \u0431\u0435\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043d\u043e\u0432\u044b\u0445 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445?<\/p>\n<p>  \u042d\u0442\u0430 \u043c\u044b\u0441\u043b\u044c \u043d\u0430\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430 \u043c\u0435\u043d\u044f \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 (Domain Specific Language), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445. \u042d\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 DSL \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0443\u0437\u043a\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/p>\n<h3>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u044f\u0437\u044b\u043a\u0443<\/h3>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u044f\u0437\u044b\u043a\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c:<\/p>\n<ul>\n<li>\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043c\u0430\u0439\u043b\u0438\u043a\u0438);<\/li>\n<li>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0438\u0433\u0443\u0440 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f;<\/li>\n<li>\u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0444\u043e\u0440\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/li>\n<\/ul>\n<p>  \u0421\u0430\u043c \u044f\u0437\u044b\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0445\u043e\u0447\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0438\u0433\u0443\u0440. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u044f \u0445\u043e\u0447\u0443 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0427\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443, \u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0444\u0438\u0433\u0443\u0440\u0430 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u044f\u0447\u0435\u0439\u043a\u0443. \u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u0440\u044f\u0434 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u0441\u043b\u0435\u0432\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043e.<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f DSL \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e <i>ANTLR, Kotlin \u0438 Gradle<\/i>. <i>ANTLR<\/i> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u043f\u0430\u0440\u0441\u0435\u0440\u0430. <i>Kotlin<\/i> \u2013 \u044d\u0442\u043e JVM \u044f\u0437\u044b\u043a, \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430 Scala. Gradle \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0431\u043e\u0440\u043a\u0438, \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u043d\u0430 <code>sbt<\/code>.<\/p>\n<h3>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f Java 1.8 \u0438 Gradle 4.6.<\/p>\n<h3>\u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c DSL.<\/p>\n<pre><code class=\"kotlin\">&gt; mkdir shaperdsl &gt; cd shaperdsl<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <code>build.gradle<\/code>. \u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 Gradle. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b, \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u0438\u0448\u044c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441.<\/p>\n<pre><code class=\"kotlin\">&gt; touch build.gradle<\/code><\/pre>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"kotlin\">buildscript {    ext.kotlin_version = '1.2.21'    ext.antlr_version = '4.7.1'    ext.slf4j_version = '1.7.25'     repositories {      mavenCentral()      maven {         name 'JFrog OSS snapshot repo'         url  'https:\/\/oss.jfrog.org\/oss-snapshot-local\/'      }      jcenter()    }     dependencies {      classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;      classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'    } }  apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'antlr' apply plugin: 'com.github.johnrengelman.shadow'  repositories {   mavenLocal()   mavenCentral()   jcenter() }  dependencies {   antlr &quot;org.antlr:antlr4:$antlr_version&quot;   compile &quot;org.antlr:antlr4-runtime:$antlr_version&quot;   compile &quot;org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version&quot;   compile &quot;org.jetbrains.kotlin:kotlin-reflect:$kotlin_version&quot;   compile &quot;org.apache.commons:commons-io:1.3.2&quot;   compile &quot;org.slf4j:slf4j-api:$slf4j_version&quot;   compile &quot;org.slf4j:slf4j-simple:$slf4j_version&quot;   compile &quot;com.audienceproject:simple-arguments_2.12:1.0.1&quot; }  generateGrammarSource {     maxHeapSize = &quot;64m&quot;     arguments += ['-package', 'com.example.shaperdsl']     outputDirectory = new File(&quot;build\/generated-src\/antlr\/main\/com\/example\/shaperdsl&quot;.toString()) } compileJava.dependsOn generateGrammarSource  jar {     manifest {         attributes &quot;Main-Class&quot;: &quot;com.example.shaperdsl.compiler.Shaper2Image&quot;     }      from {         configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }     } }  task customFatJar(type: Jar) {     manifest {         attributes 'Main-Class': 'com.example.shaperdsl.compiler.Shaper2Image'     }     baseName = 'shaperdsl'     from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }     with jar }<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0430\u0440\u0441\u0435\u0440 \u044f\u0437\u044b\u043a\u0430<\/h3>\n<p>  \u041f\u0430\u0440\u0441\u0435\u0440 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043a\u0430\u043a \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0430 <i>ANTLR<\/i>.<\/p>\n<pre><code class=\"kotlin\">mkdir -p src\/main\/antlr touch src\/main\/antlr\/ShaperDSL.g4<\/code><\/pre>\n<p>  \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"kotlin\">grammar ShaperDSL;  shaper      : 'img_dim:' img_dim ',shp_dim:' shp_dim '&gt;&gt;&gt;' ( row ROW_SEP)* row '&lt;&lt;&lt;' NEWLINE* EOF; row       : ( shape COL_SEP )* shape ; shape     : 'square' | 'circle' | 'triangle'; img_dim   : NUM ; shp_dim   : NUM ;  NUM       : [1-9]+ [0-9]* ; ROW_SEP   : '|' ; COL_SEP   : ',' ;  NEWLINE   : '\\r\\n' | 'r' | '\\n';<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u044f\u0437\u044b\u043a\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435. \u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435:<\/p>\n<pre><code class=\"kotlin\">&gt; gradle generateGrammarSource<\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 <code>build\/generate-src\/antlr<\/code>.<\/p>\n<pre><code class=\"kotlin\">&gt; ls build\/generated-src\/antlr\/main\/com\/example\/shaperdsl\/ ShaperDSL.interp  ShaperDSL.tokens  ShaperDSLBaseListener.java  ShaperDSLLexer.interp  ShaperDSLLexer.java  ShaperDSLLexer.tokens  ShaperDSLListener.java  ShaperDSLParser.java<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e<\/h3>\n<p>  \u041f\u0430\u0440\u0441\u0435\u0440 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u0434\u0435\u0440\u0435\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0414\u0435\u0440\u0435\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0410\u0421\u0414, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<pre><code class=\"kotlin\">&gt; mkdir -p src\/main\/kotlin\/com\/example\/shaperdsl\/ast &gt; touch src\/main\/kotlin\/com\/example\/shaper\/ast\/MetaModel.kt<\/code><\/pre>\n<p>  <code>MetaModel.kt<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u044f\u0437\u044b\u043a\u0435, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043a\u043e\u0440\u043d\u044f. \u0412\u0441\u0435 \u043e\u043d\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <i>Node<\/i>. \u0414\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0430\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u0432\u0438\u0434\u043d\u0430 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<pre><code class=\"kotlin\">package com.example.shaperdsl.ast  interface Node  data class Shaper(val img_dim: Int, val shp_dim: Int, val rows: List&lt;Row&gt;): Node  data class Row(val shapes: List&lt;Shape&gt;): Node  data class Shape(val type: String): Node<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0441 \u0410\u0421\u0414:<\/p>\n<pre><code class=\"kotlin\">&gt; touch src\/main\/kotlin\/com\/example\/shaper\/ast\/Mapping.kt<\/code><\/pre>\n<p>  <code>Mapping.kt<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0410\u0421\u0414 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 <code>MetaModel.kt<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u043f\u0430\u0440\u0441\u0435\u0440\u0430.<\/p>\n<pre><code class=\"kotlin\">package com.example.shaperdsl.ast  import com.example.shaperdsl.ShaperDSLParser  fun ShaperDSLParser.ShaperContext.toAst(): Shaper = Shaper(this.img_dim().text.toInt(), this.shp_dim().text.toInt(), this.row().map { it.toAst() })  fun ShaperDSLParser.RowContext.toAst(): Row = Row(this.shape().map { it.toAst() })  fun ShaperDSLParser.ShapeContext.toAst(): Shape = Shape(text)<\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c DSL:<\/p>\n<pre><code class=\"kotlin\">img_dim:100,shp_dim:8&gt;&gt;&gt;square,square|circle|triangle,circle,square&lt;&lt;&lt;<\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0410\u0421\u0414:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ny\/nu\/_d\/nynu_dssebghwcsdag2-ngv8p5s.png\"><\/p>\n<h3>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440<\/h3>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u2014 \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0410\u0421\u0414 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"kotlin\">&gt; mkdir -p src\/main\/kotlin\/com\/example\/shaperdsl\/compiler &gt; touch src\/main\/kotlin\/com\/example\/shaper\/compiler\/Shaper2Image.kt<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u042f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>  <code>ShaperParserFacade<\/code> \u2014 \u044d\u0442\u043e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u043f\u043e\u0432\u0435\u0440\u0445 <code>ShaperAntlrParserFacade<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0410\u0421\u0414 \u0438\u0437 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. <\/p>\n<p>  <code>Shaper2Image<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0410\u0421\u0414 \u043e\u0442 \u043f\u0430\u0440\u0441\u0435\u0440\u0430, \u043e\u043d \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0442\u0435\u043c \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>main<\/code> \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435-\u043a\u043e\u043c\u043f\u0430\u043d\u044c\u043e\u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<pre><code class=\"kotlin\">package com.example.shaperdsl.compiler  import com.audienceproject.util.cli.Arguments import com.example.shaperdsl.ShaperDSLLexer import com.example.shaperdsl.ShaperDSLParser import com.example.shaperdsl.ast.Shaper import com.example.shaperdsl.ast.toAst import org.antlr.v4.runtime.CharStreams import org.antlr.v4.runtime.CommonTokenStream import org.antlr.v4.runtime.TokenStream import java.awt.Color import java.awt.image.BufferedImage import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.File import java.io.InputStream import javax.imageio.ImageIO  object ShaperParserFacade {      fun parse(inputStream: InputStream) : Shaper {         val lexer = ShaperDSLLexer(CharStreams.fromStream(inputStream))         val parser = ShaperDSLParser(CommonTokenStream(lexer) as TokenStream)         val antlrParsingResult = parser.shaper()         return antlrParsingResult.toAst()     }  }   class Shaper2Image {      fun compile(input: InputStream): ByteArray {         val root = ShaperParserFacade.parse(input)         val img_dim = root.img_dim         val shp_dim = root.shp_dim          val bufferedImage = BufferedImage(img_dim, img_dim, BufferedImage.TYPE_INT_RGB)         val g2d = bufferedImage.createGraphics()         g2d.color = Color.white         g2d.fillRect(0, 0, img_dim, img_dim)          g2d.color = Color.black         var j = 0         root.rows.forEach{             var i = 0             it.shapes.forEach {                 when(it.type) {                     &quot;square&quot; -&gt; {                         g2d.fillRect(i * (shp_dim + 1), j * (shp_dim + 1), shp_dim, shp_dim)                     }                     &quot;circle&quot; -&gt; {                         g2d.fillOval(i * (shp_dim + 1), j * (shp_dim + 1), shp_dim, shp_dim)                     }                     &quot;triangle&quot; -&gt; {                         val x = intArrayOf(i * (shp_dim + 1), i * (shp_dim + 1) + shp_dim \/ 2, i * (shp_dim + 1) + shp_dim)                         val y = intArrayOf(j * (shp_dim + 1) + shp_dim, j * (shp_dim + 1), j * (shp_dim + 1) + shp_dim)                         g2d.fillPolygon(x, y, 3)                     }                 }                 i++             }             j++         }          g2d.dispose()         val baos = ByteArrayOutputStream()         ImageIO.write(bufferedImage, &quot;png&quot;, baos)         baos.flush()         val imageInByte = baos.toByteArray()         baos.close()         return imageInByte      }      companion object {          @JvmStatic         fun main(args: Array&lt;String&gt;) {             val arguments = Arguments(args)             val code = ByteArrayInputStream(arguments.arguments()[&quot;source-code&quot;].get().get().toByteArray())             val res = Shaper2Image().compile(code)             val img = ImageIO.read(ByteArrayInputStream(res))             val outputfile = File(arguments.arguments()[&quot;out-filename&quot;].get().get())             ImageIO.write(img, &quot;png&quot;, outputfile)         }     } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c jar-\u0444\u0430\u0439\u043b \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 (<i>uber jar<\/i>).<\/p>\n<pre><code class=\"kotlin\">&gt; gradle shadowJar &gt; ls build\/libs shaper-dsl-all.jar<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>  \u0412\u0441\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0432\u0441\u0435 \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0432\u0432\u0435\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"kotlin\">&gt; java -cp build\/libs\/shaper-dsl-all.jar com.example.shaperdsl.compiler.Shaper2Image \\ --source-code &quot;img_dim:100,shp_dim:8&gt;&gt;&gt;circle,square,square,triangle,triangle|triangle,circle|square,circle,triangle,square|circle,circle,circle|triangle&lt;&lt;&lt;&quot; \\ --out-filename test.png<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"1c\">.png<\/code><\/pre>\n<p>  \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pp\/dq\/6t\/ppdq6tiodfq9edarurneqi52nlq.png\"><\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 DSL, \u043e\u043d \u043d\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d, \u0438, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043f\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043e\u043d \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u0446\u0435\u043b\u0438, \u0438 \u044f \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u044d\u043c\u043f\u043b\u043e\u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 DSL.<\/p>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 DSL \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043c\u043e\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/cosmincatalin\/shaper\">github.com\/cosmincatalin\/shaper<\/a>.<\/p>\n<h2>\u0427\u0438\u0442\u0430\u0442\u044c \u0435\u0449\u0451<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/508060\/\">Kotlin vs Java<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/510788\/\">\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\/\u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044c \u043d\u0430 Kafka \u0438 Kotlin<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \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\/company\/otus\/blog\/512058\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/512058\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/512058\/\"><b><i>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0421\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u043d\u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0443\u0440\u0441\u0430 \u043e\u0442 OTUS <a href=\"https:\/\/otus.pw\/5htZ\/\">\u00abBackend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430 Kotlin\u00bb<\/a>. \u0412 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430.<\/i><\/b><\/p>\n<hr>\n<p>  \u0427\u0430\u0441\u0442\u043e \u043f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0437\u0440\u0435\u043d\u0438\u0435\u043c, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u042d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u0441\u0435\u0442\u044f\u043c\u0438.<\/p>\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-307319","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307319","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=307319"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307319\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}