{"id":654579,"date":"2020-07-22T11:23:08","date_gmt":"2020-07-22T18:23:08","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/research\/?post_type=msr-project&p=654579"},"modified":"2022-07-22T10:31:53","modified_gmt":"2022-07-22T17:31:53","slug":"prose-framework","status":"publish","type":"msr-project","link":"https:\/\/www.microsoft.com\/en-us\/research\/project\/prose-framework\/","title":{"rendered":"PROSE Framework"},"content":{"rendered":"

Microsoft Program Synthesis using Examples (PROSE)<\/h2>\n

Microsoft PROSE is a framework of technologies for programming by examples: automatic generation of programs from input-output examples.<\/p>\n

Given a domain-specific language (DSL) and input-output examples for the desired program\u2019s behavior, PROSE synthesizes a ranked set of DSL programs that are consistent with the examples.<\/p>\n

<\/div>\n

\t\t\t

\n\t\t\t
\n\t\t\t\t\t
\n\t\tDownload NuGet package<\/strong><\/a>

NuGet package for automatically synthesizing programs from examples.<\/p>

\t<\/div>\n\t \t

\n\t\tTutorial<\/strong><\/a><\/p>

A step-by-step walkthrough of the process of building a DSL in PROSE and enabling program synthesis for it.<\/p>

\t<\/div>\n\t \t

\n\t\tAPI and samples<\/strong><\/a><\/p>

If you want to apply an existing PROSE DSL, check out its documentation and our samples<\/a>.<\/p>

\t<\/div>\n\t<\/p>\t\t\t<\/div>\n\t\t<\/div>\n\t\t
\n\t\t\t

\n\t\t\t
\n\t\t\t\t\t
\n\t\tRelease notes<\/strong><\/a>

Read the release notes for the SDK.<\/p>

\t<\/div>\n\t \t

\n\t\tGitHub<\/strong><\/a><\/p>

For questions,\u00a0email us<\/a>\u00a0or\u00a0open an issue on GitHub<\/a>.<\/p>

\t<\/div>\n\t\t

\n\t\tDatasets<\/strong><\/a><\/p>

Get datasets for some DSLs in our SDK.<\/p>

\t<\/div>\n\t<\/p>\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"

Microsoft PROSE SDK is a framework of technologies for programming by examples: automatic generation of programs from input-output examples.<\/p>\n","protected":false},"featured_media":674232,"template":"","meta":{"msr-url-field":"","msr-podcast-episode":"","msrModifiedDate":"","msrModifiedDateEnabled":false,"ep_exclude_from_search":false,"_classifai_error":"","footnotes":""},"research-area":[13545,13560],"msr-locale":[268875],"msr-impact-theme":[],"msr-pillar":[],"class_list":["post-654579","msr-project","type-msr-project","status-publish","has-post-thumbnail","hentry","msr-research-area-human-language-technologies","msr-research-area-programming-languages-software-engineering","msr-locale-en_us","msr-archive-status-active"],"msr_project_start":"","related-publications":[641625,564657,335339,335864,453858],"related-downloads":[],"related-videos":[],"related-groups":[],"related-events":[],"related-opportunities":[],"related-posts":[],"related-articles":[],"tab-content":[{"id":0,"name":"Tutorial","content":"

Tutorial<\/h2>\r\nThe core component of the PROSE SDK is its program synthesis framework for custom domain-specific languages (DSLs). It allows you to define a DSL that describes a typical space of tasks in your application domain, and automatically provides parsing, execution, and synthesis technologies for this DSL. Text transformation<\/a> and text extraction<\/a> DSLs are programming-by-example technologies that have been developed on top of the PROSE core synthesis framework.\r\n\r\nThis is a step-by-step tutorial on using the PROSE framework to create new DSLs<\/em>. To use an existing DSL in your programming-by-examples application, please check out its individual documentation link on the left.\r\n

DSL Structure<\/h3>\r\nA DSL consists of four main components:\r\n
    \r\n \t
  1. Syntax<\/strong> \u2013 a context-free grammar<\/em> describing a space of possible programs in a DSL.<\/li>\r\n \t
  2. Semantics<\/strong> \u2013 an executable function for each user-defined DSL operator.<\/li>\r\n \t
  3. [optional] Witness functions<\/strong> \u2013 small \u201cinverse semantics\u201d functions that enable deductive backpropagation<\/a>, the main synthesis technology provided in the PROSE framework.<\/li>\r\n \t
  4. [optional] Features<\/strong> \u2013 computed attributes on individual programs in the DSL (for instance, a syntactic score of a program for ranking purposes).<\/li>\r\n<\/ol>\r\nBelow, we illustrate the usage of all four components on a small example DSL \u2013 a portion of FlashFill.\r\n\r\n
    \r\n\r\nSee sections on: Syntax<\/strong> |
    Semantics<\/a> | Witness functions<\/a> | Features<\/a>\r\n\r\n
    \r\n\r\n
    <\/div>\r\n

    Syntax<\/h4>\r\nOur example DSL describes a space of programs that extract a substring from a given string. They can do it in two possible ways \u2013 either extract a substring based on absolute position indices, or based on matches of regular expressions.\r\n\r\nHere\u2019s the first version of the grammar of our DSL:\r\n\r\n[code autolinks=\"true\" highlight=\"\"]\r\n#reference 'file:SubstringExtraction.dll';\r\nusing semantics SubstringExtraction.Semantics;\r\nlanguage SubstringExtraction;\r\n\r\n@input string x;\r\n\r\n\/\/ Extract a substring from 'x' between positions 'posPair'\r\n@start string out := Substring(x, posPair);\r\nTuple <int?, int?> posPair := PositionPair(pos, pos)\r\n = Pair(pos, pos);\r\nint? pos := \/\/ A position at index 'k' (from the left if k >= 0, or from the right if k < 0)\r\n AbsolutePosition(x, k)\r\n\t\/\/ A position where two regexes 'positionBoundaries' match to left and to the right,\r\n\t\/\/ respectively, and it is the 'k'-th such position\r\n\t| RegexPosition(x, positionBoundaries, k);\r\nTuple <Regex, Regex> positionBoundaries := RegexPair(r, r)\r\n = Pair(r, r);\r\n\t\r\nRegex r;\r\nint k;\r\n[\/code]\r\n\r\nHere are some possible extraction programs contained in the SubstringExtraction<\/code> DSL:\r\n