Implementing Domain Specific Languages using Dependent Types and Partial Evaluation

Similar documents
Tensor. Field. Vector 2D Length. SI BG cgs. Tensor. Units. Template. DOFs u v. Distribution Functions. Domain

ÇÙØÐ Ò Ó Ø Ø Ð ÅÓØ Ú Ø ÓÒ = ¾ ÙÔ Ö ÝÑÑ ØÖ Ò ¹Å ÐÐ ÕÙ ÒØÙÑ Ñ Ò ÆÙÑ Ö Ð Ð ÓÖ Ø Ñ Ò ÒÙÑ Ö Ð Ö ÙÐØ Ü Ø ÓÐÙØ ÓÒ ÙÖØ Ö Ô Ö Ô Ø Ú

ÙÖ ¾ Ë Ð Ø ÔÔÐ Ø ÓÒ ¾ ¾

Liveness: The Readers / Writers Problem

Ë ¼ Ë Ò Ð Ü Ñ Ò Ø ÓÒ ÈÊÁÄ ¾¼¼ ÉÙ Ø ÓÒ ½º Ë ÓÖØ Ò Û Ö Ñ Ö È ÖØ µ Ñ Ö ÖÐ Ì ÓÖ ÐÓÛ Ô Ò Ò ÓÒ Û Ø Ö Ø Ø Ø Ñ ÒØ ÌÖÙ ÓÖ Ð ½º Ì» Ú ÓÒ ÓÐ ÔÔÐ Ø ÓÒ Ò Ò ÓÓ ØÓ Û

ishares Core Composite Bond ETF

ÝØ Ð Ö Ø ÓÒ Ó ÝÒ Ñ ØÖ ÑÙÐ Ø ÓÒ Ó Ø Ú Ñ Ò Ð Ö Ø ÓÒ ÖÓÑ ØÖ ÓÙÒØ Ð Ð Ô Ö Ô Ø Ú Ø Ñ Ø ÓÒ Ó Ô Ø ÓÛ Ø ÛÓÖ Ø Ñ Ø ÓÒ Ó Ñ ÖÓ¹ ÑÙÐ Ø Ú ÓÖ ¾» ¾¾

x = x 1x 2 x (p-1)x x = 3 x = 3 x = 3 x = 3 0 x 1 x 2 x... (p-1)x

Outflow plane U=V=W=0. 2.5m. 1.95m U=V=W= m (0,0,H) 0.1m. 0.1m y. 0.41m 0.15m. 0.45m U=V=W= m Inflow plane

È Ö Ø ² ÑÔ Ö Ø Ò ÓÖÑ Ø ÓÒ ÓÖ Ñ È Ö Ø Ò ÓÖÑ Ø ÓÒ ÈÐ Ý Ö ÒÓÛ ÓÙØ Ø ÔÖ Ú ÓÙ ÑÓÚ Ó ÓÔÔÓÒ ÒØ º º º Ð ¹ËØ Û ÖØ Ñ º ÁÑÔ Ö Ø Ò ÓÖÑ Ø ÓÒ ÈÐ Ý Ö Ó ÒÓØ ÒÓÛ ÓÙØ Û

¾ ÍÆ ÌÁÇÆ Ä ËÈ Á Á ÌÁÇÆ ÒÚ ÖÓÒÑ ÒØ ½ º½ ÓÖÑ Ø Ò º º º º º º º º º º º º º º º º º º º º º º º º ½ º½º½ Ö ØÓÖÝ ÒØÖ º º º º º º º º º º º º º º º º º º

A B. Ø ÓÒ Left Right Suck NoOp

pronoun word noun noun noun phrase phrase phrase

ÅÓ Ø Ü Ø Ò ÖÓ ¹ÓÚ Ö Ö ÓÙÖ ÔÖÓÚ ÓÒÐÝ ÐÐÓÛ Ö ÔÖ ÒØ Ø ÓÒ Ñ ÒØ ÇÚ ÖÚ Û ÛÓÖÐ ÔÔÐ Ø ÓÒ Ò Ö ÓÙÖ Û Ø Ö ÝÒØ Ø Ò ¹ Ê Ð Ö ÔÖ ÒØ Ø ÓÒ º Ñ ÒØ ÅÙ Ö Ö Ö ÔÖ ÒØ Ø ÓÒ Ö

Ø Ñ Ò Ò ÙØÙÑÒ ¾¼¼¾ Ò Ò Ö ÕÙ ÒØ ÐÓ µ Ø Û Ø ØÖ ØÖÙØÙÖ ½ ȹØÖ È¹ ÖÓÛØ ÄÇË Ì È¹ØÖ Ø ØÖÙØÙÖ È¹ ÖÓÛØ Ð ÓÖ Ø Ñ ÓÖ Ò Ò ÐÐ Ö ÕÙ ÒØ Ø ÄÇË Ì Ð ÓÖ Ø Ñ ÓÖ Ò Ò Ö ÕÙ

Ë ÁÌÇ ÌÓ Ó ÍÒ Ú Ö Øݵ Ç ¼ Ô Û Ö ÙÒÓ Ø Ò Ð Ä Ò ÙÖ ÖÝ ÓÒ ÒÓØ Ý ÛÓÖ Û Ø Ã ÞÙ ÖÓ Á Ö Ó ÒØ Ë Ò ÝÓ ÍÒ Ú Ö Øݵ Ç

½º»¾¼ º»¾¼ ¾º»¾¼ º»¾¼ º»¾¼ º»¾¼ º»¾¼ º»¾¼» ¼» ¼ ÌÓØ Ð»½ ¼

1 The Multinomial logit

Deadlock. deadlock analysis - primitive processes, parallel composition, avoidance

ËØ ÒÓ Ö Ô Ý ËØ ÒÓ Ö Ô Ý ÑÓ Ó ÓÚ ÖØ ÓÑÑÙÒ Ø ÓÒº Ñ Ñ Ñ Ñ ÓÚ Ö Ñ ( ) Ø Ó ÜØ( ) Ý ÒÒ Ð Û Ø Ô Ú Û Ö Ò Ý Ò Ö ÖºÚº ÓÒ X Ò Ø Ð Ñ ÓÖ Ü ÑÔÐ Ñ ( ) ÜØ( ) ººº Ñ Ò

NS Ilist Clist F. F y<=w

Ó Ú ÐÙ Ö ÒÚÓÐÚ Ò ÖØ Ò Ô ÖØ Ó Ø ÔÖÓ Ö Ñµ Ò ØÓ ÐÔ Ø Ø ÔÖÓ Ö ÑÑ Ö Ñ Ø º ÁÒ Ø Ø ÐÐÝ ØÝÔ Ð Ò Ù Ø ØÝÔ Ö ÒÓØ Ò ÓÑ Ø Ò Ø Ø Ø Ô ÖØ Ò ÓÑÔÙØ Ø ÓÒ ÙØ Ö Ø Ö ÓÑ Ø Ò

ÅÓØ Ú Ø ÓÒ Ø Ú Øݹ ØÖ Ú Ð Ñ Ò ÑÓ Ð Ò Ô Ö ÓÒ Ð Þ ÖÚ ÓÒ Ñ ÖØÔ ÓÒ ¾» ¾

ÁÒØÖÓ ÙØ ÓÒ ÇÖ Ò Ø ÓÒ Ð Ù ÌÓÔ ÇÚ ÖÚ Û Ä ØÙÖ Ü Ö ÓÑÔÙØ Ö ÓÓ Ü Ñ Ï Ý Ñ Ø Ñ Ø ÅÓ Ð Ò Ø Ë Ø ÌÛÓ Ü ÑÔÐ

Ë ÑÙÐ Ø ÓÒ ÙÖ ØÝ Ò Ø ÔÔÐ Ô ÐÙÐÙ ËØ Ô Ò Ð ÙÒ ËØ Ú ÃÖ Ñ Ö ÇÐ Ú Ö È Ö Ö ÓÖÑ ÖÝÔØ ½»¼»¾¼¼

½½ º º À Æ Æ º º Í Æ ÒÓØ ÔÓ Ø Ú Ñ ¹ Ò Ø ÙÒÐ Ø ÓÐÐÓÛ Ò ØÖÙ Ø Ö ÓÒ Ù ÔÖÓ Ð Ñ È ½ Û Ø Ò Ð ÐÐ ÓÒ ØÖ ÒØ Û Ó ÓÖÑ Ù Ø ØÓ Ñ Ò ¾Ê Ò µ ½ ¾ Ì Ì Ø Ì Ù ÔÖÓ Ð Ñ Ø Ð

ÁÒØÖÓ ÙØ ÓÒ ØÓ ÓÑÔÙØ Ö ÈÖÓ Ö ÑÑ Ò Ò Ü Ñ ÂÙÒ ½ ¾¼¼ È ½ Ü Ö ½ ¾ ½ Å Ö µ µ ÓÒ Ö Ø ÓÓÛ Ò Ñ Ø Ó ÔÙ ÚÓ ÒØ ÒØ µ ß ¼ ¼µ ß Ö ØÙÖÒ ÒØ ¼µ ß ËÝ Ø ÑºÓÙغÔÖ ÒØÒ Ò Ø

Ò ÐÝ º Ê Ö ÓÒ ØÖ ÙØ ÓÒ Ó ÇÆ ½µ Ì ÓÙØÓÑ Ù Ð µ Ú Ö Ð Ö ÔÓÒ Ö ÔÓÒ µ Ú Ö Ð Ô Ò ÒØ Ò µ Ú Ö Ð Ú Ö Ð Y Ö Ð Ø ØÓ ÇÆ ÇÊ ÅÇÊ ÜÔÐ Ò ØÓÖÝ ÓÖ Ð Ö Ò µ Ú Ö Ð Ò Ô Ò Ò

ÇÙØÐ Ò ½ ¾ ØÖ ÙØ ÓÒ ² Ì Ò ÐÝ Ó Ö ÕÙ Ò ÔÔÐ Ø ÓÒ Ó Ø χ ¾ ËØ Ø Ø ÐÙÐ Ø Ò Ô Ú ÐÙ Ò ³ Ü Ø Ø Ø Ì ÓÒÚ ÒØ ÓÒ Ð Ú º Ø Ñ Ô ÓÔغµ È Ö ÓÒ Ò ËÔ ÖÑ Ò ÓÖÖ Ð Ø ÓÒ Ù Ò

Ð Ò ØÓ ØØ Ö Ò ÔÔÖÓÜ Ñ Ð ØÝ Ö ÙÐغ Ì ÓÙÖ Ô Ö Ñ ØÓÛ Ö Ø Ø Ö Ò ÔÔÖÓÜ Ñ Ð ØÝ Ö ÙÐØ Ò Ô Ö Ý Ø Ô Ô Ö Ó È Ô Ñ ØÖ ÓÙ Ò Î ÑÔ Ð ÓÒ ÌÖ Ú Ð Ò Ë Ð Ñ Ò ÔÖÓ Ð Ñ µ Ø


ÝÓÒ ÀÝÔ ÖØÖ Ï Ø ÓÑÔÓ Ø ÓÒ Å Ø Ó Ï Ø ÓÙØ ÓÑÔÓ Ø ÓÒ ÀÙ Ò Ò Î ØÓÖ ÐÑ Ù Ô ÖØ Ñ ÒØ Ì ÒÓÐÓ ÍÒ Ú Ö Ø Ø ÈÓÑÔ Ù Ö Ö ÐÓÒ ËÔ Ò Ù º Ò Ú ØÓÖº ÐÑ Ù ÙÔ º Ù ØÖ Øº Ì Ò

Communications Network Design: lecture 21 p.1/47

ÇÙØÐ Ò ÇÙØÐ Ò ÈÙÖÔÓ Ó Ø ÈÖÓ Ø È ÖØ Ð ÌÖ Ò ÔÓÖØ È ÖØ Ð ÁÒØ Ö Ø ÓÒ È ÖØ Ð ÔÓ Ø ÓÒ Ê ÙÐØ ËÙÑÑ ÖÝ ¾ Ôк¹Å Ø º Ò Ö ØÞ Ë Ð ¹ Ò Ì Ö È ÖØÝ ËÓ Ð Ò Ó ÅÓØÓÖ Î Ð

M 1 M 2 M 3 M 1 M 1 M 1 M 2 M 3 M 3

½º¾ Ò Ø ÓÒ Ì Ò Ó Ø ÓÚ ÕÙ Ø ÓÒ Ò ÓÖÑ Ð Þ Ý Ø ÓÐÐÓÛ Ò Ò Ø ÓÒº Ò Ø ÓÒ ½ È Ù Ó Ê Ò ÓÑ ÙÒØ ÓÒ Ñ Ðݵ Ñ ÐÝ ¾ ¼ ½ ¾Æ ÐÐ Ñ ÐÝ Ó Ð µ Ä µµ È Ù Ó Ê Ò ÓÑ ÙÒØ ÓÒ ¾

Problem. Program. Architecture/ISA. Logic. Electrons

Ë Ö Ð Þ Ø ÓÒ Ú ËØÓÖ ËÓÐÙØ ÓÒ Ï ÓÐÐÓÛ Ø ÓÒÚ ÒØ ÓÒ Ø Ø Ë Ö Ð Þ Ø ÓÒ Û Ý ØÓ Ñ Ô Ö Ø ÒØ Ø Ø Ø Ø Ò¹Ñ ÑÓÖݺ Ý ËØÓÖ ËÓÐÙØ ÓÒ Û Ñ Ò Û Ý ØÓ Ô Ø ÓÒ¹ ÙØ Û Ø ÓÙØ

ÁÒ ÙØ Ú ¹ ÙØ Ú ËÝ Ø Ñ Ñ Ø Ñ Ø Ð ÐÓ Ò Ø Ø Ø Ð Ð ÖÒ Ò Ô Ö Ô Ø Ú Æ ÓÐ ÓØ Å Ð Ë Ø ÇÐ Ú Ö Ì ÝØ Ù ÍÒ Ú Ö Ø È Ö ¹ËÙ ÆÊË ÁÆÊÁ ÈÖÓ ¾¼¼

¾ ÓÖÔÙ Ôк ÓÖÔÓÖ µ ÓÖÔÙ ÓÐÐ Ø ÓÒ Ó Ø ÜØ µ ÓÖ ÙØØ Ö Ò ½¼ Ø ÒÝ ½¼ Ö ÓÒ Ð ½¼ ½¾ ÙÖÖ ÒØ Ð Ð Ñ Ø ÓÖ ÙÒ ÒÒÓØ Ø Ø Ì ÑÓ Ø Ú ÐÙ Ð ÓÖÔÓÖ Ö Ø Ó Ø Ø ÓÙÖ Ò ØÙÖ ÐÐÝ

Ì Ö Ö Ü ÑÔÐ Ó ÒØ Ô Ø ÓÒ Ð Ò Ù Ø Ø ÔÖÓÚ ÓÓ ÙÔ¹ ÔÓÖØ ÓÖ Ô Ý Ò ÒØ Ý Ø Ñ ÒÐÙ Ò Ø ÒØ Ö Ø ÓÒ ØÛ Ò ÒØ º ÒØ ¾ Ò ÒعÓÖ ÒØ ÜØ Ò ÓÒ ØÓ Ç Ø¹ Û ÒÐÙ ÓÒ ÔØ Ù ÖÓÐ ÒØ

Á Ù Ë Ô Ö Ø ÓÒ ÒØÓ ËØÖ Ø Ý Ô Ú ÐÙ Ø ÓÒ ÓÖ Ö Ø ÖÑ Ò Ú ÐÙ Ø ÓÒ Ô Ú ÐÙ Ø ÓÒ ÔÖÓÔ Ö Ó Ø ØØÖ ÙØ Ò Ø Ò Ö Ø Ý Ø Ú ÐÙ Ø ÓÒ ØÖ Ø Ýº ÓÑÔÐ Ü ØÝ Ó Ò Ö Ø ÓÒ ÊÙÒØ Ñ

ÅÓØ Ú Ø ÓÒ ØÓ Ø ÕÙ Ù Ò ÑÓ Ð Ó ØÖ ÓÛ ÑÓ Ð Ò Ó Ö ¹ Ú Ö ØÖ Ú Ð Ú ÓÖ Ò ÐÝ Ó Ò ØÛÓÖ Ö ÓÛÒ ÓÑÔÙØ Ø ÓÒ Ó ÜÔ Ø Ú ÐÙ ººº Ô Ø ÖÓÙ Ö ÒØ Ð ÕÙ Ø ÓÒ Ð Ò Ö Þ Ø ÓÒ Ó

ÇÙØÐÓÓ ÅÓØ Ú Ø ÓÒ ÀÓÑÓØÓÔÝ ÒÚ Ö Ò Ò Ò³ Ø ÓÖ Ñ ÓÒ ØÖÙØ ÓÒ Ó Ø Ð Ñ Ó ÙÒ Ú Ö Ð ÔÓÐÝÐÓ Ö Ø Ñ Ó Ú Ö Ð Ú Ö Ð ÁÒØ Ö Ø ÓÒ ÓÚ Ö ÝÒÑ Ò Ô Ö Ñ Ø Ö Ý Ù Ó Ñ

ÌÖ Ò Ò ÆÙÑ Ö ÓÖ È ÔÓ Ø Ö ÓÖ ÖÖÓÖ ÓÒØÖÓл ÔØ Ú Ñ Ò ³ ÁØ Ö Ø Ú Ô Ö ÐРе ÓÐÙØ ÓÒ ØÖ Ø ³ ÇÔ Ö ØÓÖ¹ ÔÐ ØØ Ò ÓÖ ÓÙÔÐ ÔÖÓ Ð Ñ ³ Ê ÙØ ÓÒ Ó ÒÙÑ Ö Ð ÓÑÔÐ Ü ØÝ

Kevin Dowd, after his book High Performance Computing, O Reilly & Associates, Inc, 1991

½ Ê Ú Û Ó ÆÒ ÕÙÓØ ÒØ ¾ ÇÖØ Ó ÓÒ Ð ÒÚ Ö ÒØ ÓÙ Ð Ö Ø ÓÒ Ý ÕÙÓØ ÒØ Ñ Ô ÇÖ Ø ÓÖÖ ÔÓÒ Ò Ü ÑÔÐ Ó ÓÖ Ø ÓÖÖ ÔÓÒ Ò Ü ÑÔÐ Ø Ò ÓÖ ÔÖÓ ÙØ Ü ÑÔÐ ÓÒØÖ Ø ÓÒ Ñ Ô ÇÔ Ò

ÅÓØ Ú Ø ÓÒ Å ÕÙ Ð ØÝ Ó Ø Ó ØÖ Ò Ô Ö ÒØ ÁÒ Ø ÓÒ Ú ÐÓÔÑ ÒØ ØÖ Ò ÖÖ Û ÓÖ Ò Ð ÙØ ÓÖ Ö Ñ Ò ÐÓÒ Ú ÐÓÔÑ ÒØ ØÓÖÝ Å ÒÝ Ù ØÓÑ Ö»Ù ØÓÑ Ö Ù ÓÑÔÓÒ ÒØ Ó Ñ ÒÝ ÔÖÓ Ø

ÇÙØÐ Ò Ó Ø Ð ÅÓØ Ú Ø ÓÒ ÔÓÐÝÒÓÑ Ð Ú ÓÒ ÒÓ Ò ÓÖ ÝÐ Ó ÙØÓÑÓÖÔ Ñ µ ÑÓ ÙÐ ÕÙ ¹ÝÐ µ ØÖÙ¹ ØÙÖ ÖĐÓ Ò Ö ÓÖ ÑÓ ÙÐ Ú ÐÙ Ø ÓÒ Ó ÖÓÑ ÓÖ Ö ÓÑ Ò Ò¹ ÐÙ Ò ÓÔÔ Ó µ Ü Ñ


É ÀÓÛ Ó Ý Ò ² Ö Ò ÁÒ Ö Ò «Ö ÓØ ÑÔ Ù ÔÖÓ Ð ØÝ ØÓ Ö ÙÒ ÖØ ÒØÝ ÙØ Ø Ý ÓÒ Ø ÓÒ ÓÒ «Ö ÒØ Ø Ò º Ü ÑÔÐ ÁÑ Ò Ð Ò Ð ØÖ Ð Û Ø Ò ½ Ñ Ø Ô Ö Ó Ù Ø º ÁÒ Ô Ö ÓÒ Ù Ø

ÓÙØÓÑ Ø º Ò ÖÝ Ø Ñ Ý Ò Ö Ø Ý Ò ÖÝ ÖÓÙÔ Ó Ô Ö ÓÒ ÓÐÐÓÛ ÓÖ Ú Ò Ø Ñ ÒØ ÖÚ Ð Ò Ø Û Ø Ö ÓÖ ÒÓØ Ú Ò Ú ÒØ ÓÙÖ Ó ÖÚ Ó ÓÖØ ØÙ Û Ø Ü ÓÐÐÓÛ¹ÙÔ Ø Ñ Ø Ø ÖÓÑ Ú Ò Ù

ÐÓ Û µ ÅÄ Ó Ò ººº Ð Ò Ö Ó Ü = (,..., Ü Ò ) ººº ÒØ Ó ÛÓÖ Ý = (Ý ½,..., Ý Ò ) ººº Ö Ú ÛÓÖ ¹ ÓÒ Ø ÒØ ÐÓ Û µ Å Ü ÑÙÑ Ä Ð ÓÓ Åĵ Ó Ö Ø Ø ÔÓ Ð Ó Ö Ñ Ò Ñ Þ Ø

ËÓÙÖ Ö Ø Ò Ö³ Ó Ø ÓÒ Ò ÐÓÓÑ Ö

ÓÖ Ø ÁÒØ Ð ÔÖÓ ÓÖ Ñ Ðݺ Ê Ö Û ÒØ Ò Ò Ö Ð ÖÓÙÒ Ò Ñ Ð Ö ÔÖÓ Ö Ñ¹ Ñ Ò ÓÙÐ ÓÒ ÙÐØ ÔÔÖÓÔÖ Ø Ø ÜØ ÓÓ Ò ÓÒ ÙÒØ ÓÒ Û Ø Ø ÔÖÓ ÓÖ Ö Ö Ò Ñ Ò¹ Ù Ð ÔÙ Ð Ý ÁÒØ Ð Ò

ÇÙØÐ Ò È Ý Ð ÓÒ Ø ÓÒ Ò ÓÙ Æ ÙÐ ÄÓÛ¹ Ò ØÝ Ð Ñ Ø À ¹ Ò ØÝ Ð Ñ Ø Ü ÑÔÐ ÜØ ÒØ ÓÒ ØÓÛ Ö ÐÑ Ö Ö Ñ ÒØ Ò

ÇÙØÐ Ò ÖÓÙÒ Ü ÑÔÐ ÔÖÓ Ö Ñ ÒÓ Ñ Ø Ó Ü ÑÔÐ ÒÓ Ì ÓÖÝ ÓÒÐÙ ÓÒ ¾

TCP SOURCE TCP DESTINATION

Control X Switch X=1, SW ON X=0, SW OFF F(X)=X F un tion Implementation N. Mekhiel

Ì Ø Ð ÓÒ Ò Ò ÐÓ Ù Ó Ó Ñ³ Ø ÓÖ Ñ ÓÖ Ö Ø Ð ÑÞ Û ¹ ÐÐ ¾¼½½ ÇÒ Ø Ø Ó Ö Ð ÒÙÑ Ö Ö Ó Ò Þ Ý Ò Ø ÙØÓÑ Ø Ò ÑÙÐØ ÔÐ Ó ÐÓع ÖÙ Ø Ò¹ ÖÙÝ Ö ¾¼½¼ Ö Ø¹ÓÖ Ö ÐÓ Ò ÆÙÑ

ÓÒÒ Ø ÓÒ ØÓ Ñ ÞÓÒ Ú Ø Æ Ø Ô ÓÖ ÖÓÑ Û ÖÓÛ Öº ÌÓ Ú Û ËÌÄ Ð ÓÒ ÑÝ Ä ÒÙÜ Ñ Ò Á Ù Æ Ø Ò Å Ò Ö¹ ØÓÖº ÌÓ ÔÖÓ Ù Ø ÇÔ ÒË Ö ÔØ Á Ù ÇÔ ÒË Û Ø Ø³ ÒØ Ö Ø Ø ÜØ ØÓÖ

Accounts(Anum, CId, BranchId, Balance) update Accounts set Balance = Balance * 1.05 where BranchId = 12345

ÇÙØÐ Ò ½ ¾ ÓÙÒ ¹Ô Ö Ñ Ø Ö Å Ö ÓÚ ÓÒ ÈÖÓ Å Èµ ÖÒ Ò Ó Äº Ù ÙÑ Ã Ö Ò Îº Ð Ó Ò Ä Ð Ò Æº ÖÖÓ

½ ÁÒØÖÓ ÙØ ÓÒ Ê ÒØ Ö ÙÐØ Ò ÑÔÐ Ñ ÒØ Ø ÓÒ Ó Ø ÔÐ ÒÒ Ö ½ Ú Ö Ø Ò¹ Ø Ö Ø ÓÖ Ù Ø Ð ÔÔÐ Ð ØÝ Ó Ø ÔÐ ÒÒ Ò ÔÔÖÓ ØÓ Ñ ÒÝ Ö Ð ÛÓÖÐ ÔÖÓ Ð Ñ º ÍÒ ÓÖØÙÒ Ø ÐÝ Ø ÔÖ

ÓÒØ ÒØ ½ ÇÚ ÖÚ Û ½ ¾ Ö Ø ØÙÖ Ð Ö ÔØ ÓÒ ½ ¾º½ Ê Ø Ö º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º º ½ ¾º¾ ÙÒ Ñ ÒØ Ð ÌÝÔ º º

ÁÒØÖÓ ÙØ ÓÒ Ö ÔØ Ú ËØ Ø Ø ÁÒ Ö ÒØ Ð ËØ Ø Ø ÀÝÔÓØ Ø Ø Ò ¹ Ô Ú ÐÙ Ø ÖÑ Ò Ø ÓÒ Ó ÑÔÐ Þ ËÙÑÑ ÖÝ Ä ÖÒ Ò Ó¹ Ø ÖÑ Æ ÙÝ Ò Ì ÌÙ Î Ò ½ Æ ÙÝ Ò ÉÙ Ò Î Ò ¾ ½ ÍÒ Ú

¾ Å Ö ÒÓÚ Ò Ã ÙÖ ÁÒ Â Ú Ø ÕÙ Ñ Ø Ó Û ÓÛ ÓÑÔ Ö Ò Ó Ø Ú Ù ÓÔ¹ ÔÓ ØÓ Ù Ò Ø ³ ÓÔ Ö ØÓÖ Û ÓÑÔ Ö Ó Ø ÒØ Ø ÓÚ ÖÖ Ò Ò Ñ ÓÖ ØÝ Ó º ÓÓ ÔÖÓ Ö ÑÑ Ò Ñ Ø Ó ÓÓ Ý Ù Ø


ÈÖÓÚ Ò Ò ÁÑÔÐ Ø ÓÒ È É Ï Ö Ø ÐÓÓ Ø Û Ý ØÓ ÔÖÓÚ Ø Ø Ñ ÒØ Ó Ø ÓÖÑ Á È Ø Ò É ÓÖ È É Ì ÓÐÐÓÛ Ò ÔÖÓÓ ØÝÔ Ò Ð Ó Ù ØÓ ÔÖÓÚ Ø Ø Ñ ÒØ Ó Ø ÓÖÑ Ü È Üµ É Üµµ Ý ÔÔ

COMPARATIVE EVALUATION OF WEATHER FORECASTS FROM THE COSMO, ALARO AND ECMWF NUMERICAL MODELS FOR ROMANIAN TERRITORY

ÇÆÌ ÆÌ ËÙ Ø Ú ÒØÖÓ ÙØÓÖÝ Ö Ñ Ö Å Ø Ô ÓÖ Ò Ø Ú ÔÔÖÓ Ì Ô ÐÓ ÓÔ Ð Ö Ò À ÖÑ Ò ÙØ Ò Ø Ö Ð Ø ÓÒ Ô ØÓ Ò Ì ÒØ ÖÔÖ Ø Ò Ò Ø ÒØ ÖÔÖ Ø Ö Ò

ÓÒØ ÒØ ¾

ÇÙØÐ Ò ½º Ê Ú Û Ó ËÔ Ò¹ Ü Ò ÇÔØ Ð ÈÙÑÔ Ò ¾º Ê Ú Û Ó Ô Ø ÜÔ Ö Ñ ÒØ º Ì Æ Û Ö Ø ÓÒ Ô ÖØ ÓÑ Ò Ö ² ÀÓÑÓ Ò Þ Ö ÀÝ Ö Ð Ð Ë ÇÈ ÒÓ Ø ØÓÓÐ ÂÙÒ ¾¼¼ º Ë Ò È ¾

ÁÁ Å Ø ö ÀÖ Ö ÂÙÖ Ê ÚÒ ÆÙÑ Ö ÒÓ ÑÓ Ð Ö Ò Ò Ö ÙÒ ÐÒ ÑÙÐ ½º Ð Ö Ò ÒÙÑ Ö Ò Ö ÙÒ Ò ¾¼½¾ ÙÐØ Ø Þ ØÖÓ Ò ØÚÓ ÍÒ Ú ÖÞ Ú Å Ö ÓÖÙ Æ ÐÓÚ ÔÙ Ð ÎÖ Ø ÔÙ Ð ÚØÓÖ Ê ÒÞ

ÁÒØÖÓ ÙØ ÓÒ ËØ Ø Ø Ð Ò ÐÝ ÓÖ Ö Ø Ø Ô ÖØ Ù¹ Ð ÖÐÝ ÓÖ ÔÖÓ Ð ØÝ ÑÓ Ð Ù Ø ÒÓ¹ Ñ Ð ÈÓ ÓÒ Ò ÑÙÐØ ÒÓÑ Ð Ý ÒÓÛ Ú ÖÝ Û ÐÐ ÙÒ Ö ØÓÓ Û Ø Û ÐØ Ó Ù Ø Ð Ó Ø¹ Û Ö º

Accounts(Anum, CId, BranchId, Balance) update Accounts set Balance = Balance * 1.05 where BranchId = 12345

Ú Ð Ð ÓÒÐ Ò Ø ØØÔ»» Ѻ Ö Ùº º Ö ÁÒغ º ÁÒ Ù ØÖ Ð Å Ø Ñ Ø ÎÓк ÆÓº ¾¼½½µ ½ ½¹½ ½ Ê Ò Ò ÍÒ Ø Ò Ý Í Ò Ø ÎÓØ Ò ËÝ Ø Ñ Åº à ÒÑÓ ÑÑ Êº ÐÐ Ò µ Ô ÖØÑ ÒØ Ó Å

ØÖ Ø Ì Ö ÔÓÖØ Ö Ø Ü ÓÓÐ Ý Ø Ñº Ì ÔÖÓ Ö Ñ Ô Ö ÓÖÑ ÓÓÐ Ò ÓÔ Ö Ø ÓÒ ÓÒ ÙÐÔØÙÖ ÓÐ º Ì ÓÙÒ ÖÝ Ó ÓÐ Ö ÔÖ ÒØ Ù Ò ØÖ ÑÑ ÆÍÊ Ë ÆÓÒ ÍÒ ÓÖÑ Ê Ø ÓÒ Ð ¹ËÔÐ Ò µ ÙÖ

address bus Data bus Note: Instructions are fetched over data bus CPU Control ALU

Ø Ñ Ñ Ò µ Ú Ù ¾ ¾ ½ ÓÒØ Ò Ö Ú Ù Ú Ù µ ÔÓ Ö Ø Ö ØÓÖ Ú ØÓÖ Ø Ö Ø Ø ÓÚ Ö ÓÒØ Ò Ö Ú ØÓÖ Ø Ö ØÓÖ Ø ÓÒØ Ò Öº Ò µ Ø ÓÒØ Ò Öº Ò µ Ø µ Ù Ø Ñ Ø Ö Ø ÓÒ ÓÒØ Ò Öº

Æ ÛØÓÒ³ Å Ø Ó ÐÓ Ì ÓÖÝ Ò ËÓÑ Ø Ò ÓÙ ÈÖÓ ÐÝ Ò³Ø ÃÒÓÛ ÓÙØ Ú º ÓÜ Ñ Ö Ø ÓÐÐ

Degradation

ÚÓ Ù ØÖ Ó Ø Ö ÓÙÒØ Øµ ØÖÙØ Ø ÒÓ Ø Ñµ» Ø ÚÓ Ù ØÖ Ó Ø Ö ÓÙÒØ ÔÙص ØÖÙØ Ø ÒÓ Ø Ñµ» Ø ØÖÙØ Ù ØÖ Ó Ý Ö Ò Ñ ½¼ Ô ÒÓ Ø Ó» Ó Ý Ó» ØÖÙØ Ù ØÖ Ù Ø Ø ¾ Ñ Ü Þ» Ò Ø


Significant sample +... Synthetic Population. IPFP + Random Draws. Set of consistent margins

P1 P2 PN C C C C. Shared Bus I/O. Shared Memory

ÇÙØÐ Ò ½ Ï Ø ØÓ ØÙ Ý ÓÙØ ÐØ ² ÙÖ ¾ ÓÐÓ Ð ÅÓ Ð ÐÓÓ Ø Ø ÓÖ Ø À Ö Ö Ð ÅÓ Ð Ò Ú Ù Ð Æ ÖÓÙÔ ÐÓÛ Ò ÐÝ ØÓÓÐ ØÓ ØÙ Ý ÑÓÚ Ñ ÒØ Ù ÓÒ Å Ö Ð Ë ÖÚ Ð Ó À ÐØ ² ÍÖ ÈÁ

Ã Ô ÐÐ Ø ÙÒ Ð ÕÙ Ô Ò ÙÖ ÓÑ Ú ÒØ Ö Ø ÓÒ Ò ÓÑÔ Ø Ø ÓÒ Ä ÙÖ Å ËËÁÇ ÄÈÌÅ ÍÒ Ú Ö Ø È Ö ÎÁ ¾½ ÒÓÚ Ñ Ö ¾¼½

ÌÖ Ò Ò ÆÙÑ Ö ÓÖ È ÔÓ Ø Ö ÓÖ ÖÖÓÖ ÓÒØÖÓл ÔØ Ú Ñ Ò ³ ÁØ Ö Ø Ú Ô Ö ÐРе ÓÐÙØ ÓÒ ØÖ Ø ³ ÇÔ Ö ØÓÖ¹ ÔÐ ØØ Ò ÓÖ ÓÙÔÐ ÔÖÓ Ð Ñ ³ Ñ ÁÑÔÖÓÚ Ñ ÒØ Ó Æ ÒÝ Ú ½º ÇÔ

arxiv: v25 [math.ca] 21 Nov 2008

Ë Ø Ó ÒÙÑ Ö Ò Ø Ö Ö ÔÖ ÒØ Ø ÓÒ ÁÒ Ø ÓÙÖ Û Û ÐÐ ÒØ Ö Ø Ò Ø Ó ÒÙÑ Ö º ÁÒ ÓÑÔÙØ Ö Ò Û Ö ÓÒ ÖÒ Ý Ø ÕÙ Ø ÓÒ ÓÛ Ó Û Ú Ù Ø Ø ÓÙÖ ÔÓ Ð Ì Û Ý ÒÙÑ Ö Ø ÓÒ Ý Ø Ñ

ÁÒ Ø ÖÑ Ó Ð Ò Ù Ø ÓÖÝ ÒÙÑ Ö Ð ÓÙÖÖ Ò Ò ØÓÖ Ö Ò Ò Ò¹ Ø Ð ÜØ Ò Ò Ü ØÐÝ Ø Ñ Ð Ó Ö ÙÐ Ö Ð Ò Ù Ò Ö Û Ø Ø Ò Ö Ö ÙÐ Ö ÜÔÖ Û Ø ÓÙØ ÒÙÑ Ö Ð ÓÙÖÖ Ò Ò ØÓÖ º ÇÒ Ø

ËØÖÙØÙÖ ½ Î Ö ÐÙ Ø Ö ¹ Ò ÒØÖÓ ÙØ ÓÒ ¾ Ì Ø Ì ÈÙÞÞÐ Ì Á ÓÒÐÙ ÓÒ ÈÖÓ Ð Ñ Å Ö ¹ÄÙ ÈÓÔÔ ÍÒ Ä ÔÞ µ È Ö Ø È ÖØ ÔÐ ¾¼º¼ º½ ¾» ¾

Ä ÖÒ Ò ÖÓÑ Ø Ö Ëº Ù¹ÅÓ Ø Ð ÓÖÒ ÁÒ Ø ØÙØ Ó Ì ÒÓÐÓ Ý Ä ØÙÖ ½ Ì Ä ÖÒ Ò ÈÖÓ Ð Ñ ËÔÓÒ ÓÖ Ý ÐØ ³ ÈÖÓÚÓ Ø Ç ² Ë Ú ÓÒ Ò ÁËÌ ÌÙ Ý ÔÖ Ð ¾¼½¾

ÖÖ Ý ÒÑ ÒØ Ø Ø Ñ ÒØ Ö Ö ÓÖ ÒÝ Ð Ø¹ Ò Ð Ñ ÒØ Ö ØÓÖ º ÖÖ Ý ÓÖ Ù Ø ÓÒ Ó ÖÖ Ý Ò Ô Ý Ù Ò ØÖ ÔÐ Ø Ù Ö ÔØ º ØÖ ÔÐ Ø Ô Ö Ò Ò Ø ÓÖÑ ÐÓÛ Ö ÓÙÒ ÙÔÔ Ö ÓÙÒ ØÖ º Á

Density Data

λ = λ = 1.0 w Ø w = C (w) + λ N wì w

Ö Ò ÁÅ ÔØ Ö Ê ÕÙ Ö ÔØ Ö ½¼ ½ Ò ½ º ÄÏÀ ØÓ ÖØ Ð ÁÒØ ÐÐ Ò ÁÒØÖÓ ÙØ ÓÒ ¹ ËÔÖ Ò ¾¼½ Ë º ÓÙ ÖÝ Ë Ù¹Û ¹Ö µ ÖØ ¼¾µ ¾¹ º º ÓÙ ÖÝ ½ ÁÒ ØÖÙØÓÖ³ ÒÓØ ÖÙ ÖÝ ½ ¾¼½

Dagstuhl Seminar Proceedings 05451Dagstuhl Seminar Proceedings Beyond Program Slicing

ÁÒØÖÓ ÙØ ÓÒ ¹ ÉÙ Ø ÓÒ Ï Ø ÖÓÚ ÑÓÖØ ÙÐØ ÙÖ Ò Ø Ö

Transcription:

Implementing Domain Specific Languages using Dependent Types and Partial Evaluation Edwin Brady eb@cs.st-andrews.ac.uk University of St Andrews EE-PigWeek, January 7th 2010 EE-PigWeek, January 7th 2010 p.1/27

Introduction This talk is about applications of dependently typed programming. It will cover: Briefly, an overview of functional programming with dependent types, using the language Idris. Domain Specific Language (DSL) implementation. A type safe interpreter Code generation via specialisation Network protocols as DSLs Performance data EE-PigWeek, January 7th 2010 p.2/27

Idris Idris is an experimental purely functional language with dependent types ( ØØÔ»»ÛÛÛº º ع Ò º ºÙ»»Á Ö ). Compiled, via C, with reasonable performance (more on this later). Loosely based on Haskell, similarities with Agda, Epigram. Some features: Primitive types (ÁÒØ, ËØÖ Ò, Ö,... ) Interaction with the outside world via a C FFI. Integration with a theorem prover, Ivor. EE-PigWeek, January 7th 2010 p.3/27

Why Idris? Why Idris rather than Agda, Coq, Epigram,...? Useful to have freedom to experiment with high level language features. I want to see what we can achieve in practice, so: Need integration with the outside world foreign functions, I/O. Programs need to run sufficiently quickly. EE-PigWeek, January 7th 2010 p.4/27

Why Idris? Why Idris rather than Agda, Coq, Epigram,...? Useful to have freedom to experiment with high level language features. I want to see what we can achieve in practice, so: Need integration with the outside world foreign functions, I/O. Programs need to run sufficiently quickly. (whisper: sometimes, in the short term, it s useful to cheat the type system) EE-PigWeek, January 7th 2010 p.4/27

Why Idris? Why Idris rather than Agda, Coq, Epigram,...? Useful to have freedom to experiment with high level language features. I want to see what we can achieve in practice, so: Need integration with the outside world foreign functions, I/O. Programs need to run sufficiently quickly. (whisper: sometimes, in the short term, it s useful to cheat the type system) Making a programming language is fun... EE-PigWeek, January 7th 2010 p.4/27

Dependent Types in Idris Dependent types allow types to be parameterised by values, giving a more precise description of data. Some data types in Idris: Ø Æ Ø Ç Ë Æ Ø Ò ÜÖ ¹¹ Ò Ò Ò Ü ÓÔ Ö ØÓÖ Ø Î Ø Ë Ø ¹ Æ Ø ¹ Ë Ø Û Ö ¹¹ Ä Ø Û Ø Þ ÎÆ Ð Î Ø Ç µ ¹ Î Ø ¹ Î Ø Ë µ We say that Î Ø is parameterised by the element type and indexed by its length. EE-PigWeek, January 7th 2010 p.5/27

Functions The type of a function over vectors describes invariants of the input/output lengths. e.g. the type of Ú expresses that the output length is the same as the input length: Ú Î Ø ÁÒØ Ò ¹ Î Ø ÁÒØ Ò ¹ Î Ø ÁÒØ Ò Ú ÎÆ Ð ÎÆ Ð ÎÆ Ð Ú Ü Ü µ Ý Ý µ Ü Ý Ú Ü Ý The type checker works out the type of Ò implicitly, from the type of Î Ø. EE-PigWeek, January 7th 2010 p.6/27

Input and Output I/O in Idris works in a similar way to Haskell. Ö Î e.g. reads user input and adds to an accumulator: Ö Î Î Ø ÁÒØ Ò ¹ ÁÇ Ô Î Ø ÁÒØ Ô µ Ö Î Ü Ó ß ÔÙØËØÖ ÆÙÑ Ö Ú Ð ¹ ØÁÒØ Ú Ð ¹½ Ø Ò Ö ØÙÖÒ Ü Ð Ö Î Ú Ð Ü µµ Ð The program returns a dependent pair, which pairs a value with a predicate on that value. EE-PigWeek, January 7th 2010 p.7/27

The Û Ø Rule The Û Ø rule allows dependent pattern matching on intermediate values: Ú ÐØ Ö ¹ ÓÓе ¹ Î Ø Ò ¹ Ô Î Ø Ôµ Ú ÐØ Ö ÎÆ Ð ÎÆ Ð Ú ÐØ Ö Ü Ü µ Û Ø Ü Ú ÐØ Ö Ü µ ß ÌÖÙ Ü ³ µ Ü Ü ³ Ð Ü ³ µ Ü ³ Ð The underscore means either match anything (on the left of a clause) or infer a value (on the right). EE-PigWeek, January 7th 2010 p.8/27

Libraries Libraries can be imported via ÒÐÙ Ð º Ö. All programs automatically import ÔÖ ÐÙ º Ö which includes, among other things: Primitive types ÁÒØ, ËØÖ Ò and Ö, plus Æ Ø, ÓÓÐ Tuples, dependent pairs. Ò, the finite sets. Ä Ø, Î Ø and related functions. Å Ý and Ø Ö The ÁÇ monad, and foreign function interface. EE-PigWeek, January 7th 2010 p.9/27

A Type Safe Interpreter A common introductory example to dependent types is the type safe interpreter. The pattern is: Define a data type which represents the language and its typing rules. Write an interpreter function which evaluates this data type directly. [demo: ÒØ ÖÔº Ö] EE-PigWeek, January 7th 2010 p.10/27

A Type Safe Interpreter Notice that when we run the interpreter on functions without arguments, we get a translation into Idris: Á Ö ÒØ ÖÔ ÑÔØÝ Ø Ø Ü ÁÒØ º ܼ ÁÒØ º Ü Ü¼ Á Ö ÒØ ÖÔ ÑÔØÝ ÓÙ Ð Ü ÁÒØ º Ü Ü Idris implements ± Ô and ± Ö Þ annotations which control the amount of evaluation at compile time. [demo: ÒØ ÖÔº Ö again] EE-PigWeek, January 7th 2010 p.11/27

A Type Safe Interpreter We have partially evaluated these programs. If we can do this reliably, and have reasonable control over, e.g., inlining, then we have a good recipe for efficient Domain Specific Language (DSL) implementation: Define the language data type Write the interpreter Specialise the interpreter w.r.t. real programs If we trust the host language s type checker and code generator admittedly we still have to prove this, but only once! then we can trust the DSL implementation. EE-PigWeek, January 7th 2010 p.12/27

Resource Usage Verification We have applied the type safe interpreter approach to a family of domain specific languages with resource usage properties, in their type: File handling Memory usage Concurrency (locks) Network protocol state As an example, I will outline the construction of a DSL for a simple network transport protocol. EE-PigWeek, January 7th 2010 p.13/27

Example Network Protocols Protocol correctness can be verified by model-checking a finite-state machine. However: There may be a large number of states and transitions. The model is needed in addition to the implementation. Model-checking is therefore not self-contained. It can verify a protocol, but not its implementation. EE-PigWeek, January 7th 2010 p.14/27

Example Network Protocols In our approach we construct a self-contained domain-specific framework in a dependently-typed language. We can express correctness properties in the implementation itself. We can express the precise form of data and ensure it is validated. We aim for Correctness By Construction. EE-PigWeek, January 7th 2010 p.15/27

ARQ Our simple transport protocol: Automatic Repeat Request (ARQ) Separate sender and receiver State Session state (status of connection) Transmission state (status of transmitted data) EE-PigWeek, January 7th 2010 p.16/27

Session State EE-PigWeek, January 7th 2010 p.17/27

Transmission State EE-PigWeek, January 7th 2010 p.18/27

Session Management ËÌ ÊÌ initiate a session ËÌ ÊÌ Ê Î Ã wait for the receiver to be ready Æ close a session Æ Ê Î Ã wait for the receiver to close EE-PigWeek, January 7th 2010 p.19/27

Session Management ËÌ ÊÌ initiate a session ËÌ ÊÌ Ê Î Ã wait for the receiver to be ready Æ close a session Æ Ê Î Ã wait for the receiver to close When are these operations valid? What is their effect on the state? How do we apply them correctly? EE-PigWeek, January 7th 2010 p.19/27

Session Management We would like to express contraints on these operations, describing when they are valid, e.g.: Command Precondition Postcondition ËÌ ÊÌ ÄÇË ÇÈ ÆÁÆ ËÌ ÊÌ Ê Î Ã ÇÈ ÆÁÆ ÇÈ Æ (if à received) ÇÈ ÆÁÆ (if nothing received) Æ ÇÈ Æ ÄÇËÁÆ Æ Ê Î Ã ÄÇËÁÆ ÄÇË (if à received) ÄÇË (if nothing received) EE-PigWeek, January 7th 2010 p.20/27

Sessions, Dependently Typed How do we express our session state machine? Make each transition an operation in a DSL. Define the abstract syntax of the DSL language as a dependent type. Implement an interpreter for the abstract syntax. Specialise the interpreter for the ARQ implementation. This is the recipe we followed for the well typed interpreter... EE-PigWeek, January 7th 2010 p.21/27

Session State, Formally ËØ Ø carries the session state, i.e. states in the Finite State Machine, plus additional data: Ø ËØ Ø ÄÇË ÇÈ Æ ÈËØ Ø ¹¹ ØÖ Ò Ñ ÓÒ Ø Ø ÄÇËÁÆ ÇÈ ÆÁÆ ÈËØ Ø carries the transmission state. An open connection is either waiting for an à or ready to send the next packet. Ø ÈËØ Ø Ï Ø Ò Ë Õ ¹¹ Õº ÒÓº Ê Ý Ë Õ ¹¹ Õº ÒÓº EE-PigWeek, January 7th 2010 p.22/27

Sessions, Formally ÊÉÄ Ò is a data type defining the abstract syntax of our DSL, encoding state transitions in the type: Ø ÊÉÄ Ò ËØ Ø ¹ ËØ Ø ¹ Ë Ø ¹ Ë Ø Û Ö ËÌ ÊÌ ÊÉÄ Ò ÄÇË ÇÈ ÆÁÆ µ ËÌ ÊÌ Ê Î Ã Ó ÊÉÄ Ò ÇÈ Æ Ê Ý Ö Øµµ Ìݵ ¹ Ð ÊÉÄ Ò ÇÈ ÆÁÆ Ìݵ ¹ ÊÉÄ Ò ÇÈ ÆÁÆ Ìݵ ººº [demo: ÊÉ Ðº Ö] EE-PigWeek, January 7th 2010 p.23/27

Results We have implemented a number of examples using the DSL approach, and compared the performance of the interpreted and specialised versions with equivalent programs in C and Java. File handling Copying a file Processing file contents (e.g. reading, sorting, writing) Functional language implementation Well-typed interpreter extended with lists EE-PigWeek, January 7th 2010 p.24/27

Results Run time, in seconds of user time, for a variety of DSL programs: ؽ ؾ ÙÑÐ Ø ÓÔÝ ÓÔÝ ÝÒ Ñ ÓÔÝ ØÓÖ ÓÖØ Ð ÊÉ Program Spec Gen Java C 0.017 8.598 0.081 0.007 1.650 877.2 1.937 0.653 3.181 1148.0 4.413 0.346 0.589 1.974 1.770 0.564 0.507 1.763 1.673 0.512 1.705 7.650 3.324 1.159 5.205 7.510 2.610 1.728 0.149 0.240 EE-PigWeek, January 7th 2010 p.25/27

Conclusion Dependent types allow us to implement embedded DSLs with rich specification/verification. Also: We need an evaluator for type checking anyway, so why not use it for specialisation? Related to MetaOCaml/Template Haskell, but free! If (when?) we trust the Idris type checker and code generator, we can trust our DSL. DSL programs will be as efficient as we can make Idris (i.e. no interpreter overhead). Lots of interesting (resource related) problems fit into this framework. EE-PigWeek, January 7th 2010 p.26/27

Further Reading Scrapping your Inefficient Engine: using Partial Evaluation to Improve Domain-Specific Language Implementation E. Brady and K. Hammond, submitted 2009. Domain Specific Languages (DSLs) for Network Protocols S. Bhatti, E. Brady, K. Hammond and J. McKinna, In Next Generation Network Architecture 2009. ØØÔ»»ÛÛÛº º ع Ò Ö Û º ºÙ»» Ò» ÊÉ Ðº ØÑÐ ARQ DSL implementation ØØÔ»»ÛÛÛº º ع Ò Ö Û º ºÙ»»Á Ö ØØÔ»»ÛÛÛº º ع Ò Ö Û º ºÙ»»Á Ö»ØÙØÓÖ Ðº ØÑÐ EE-PigWeek, January 7th 2010 p.27/27