making maude definitions more interactive
play

Making Maude Definitions more Interactive Andrei Arusoaie 1 a 1 , 2 - PowerPoint PPT Presentation

Introduction Adding I/O to Maude How it works in K Conclusions and Future Work Making Maude Definitions more Interactive Andrei Arusoaie 1 a 1 , 2 Traian Florin S erb anut Chucky Ellison 2 su 2 Grigore Ro 1 University Alexandru


  1. Introduction Adding I/O to Maude How it works in K Conclusions and Future Work Making Maude Definitions more Interactive Andrei Arusoaie 1 a 1 , 2 Traian Florin S ¸erb˘ anut ¸˘ Chucky Ellison 2 su 2 Grigore Ro¸ 1 University Alexandru Ioan Cuza of Ia¸ si 2 University of Illinois at Urbana-Champaign March 28, 2012 Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 1/20

  2. Introduction Adding I/O to Maude How it works in K Conclusions and Future Work Introduction Motivation Adding I/O to Maude Scenario Our solution Maude I/O Interface Architecture How it works in K Conclusions and Future Work Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 2/20

  3. Introduction Adding I/O to Maude Motivation How it works in K Conclusions and Future Work Plan Introduction Motivation Adding I/O to Maude Scenario Our solution Maude I/O Interface Architecture How it works in K Conclusions and Future Work Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 3/20

  4. Introduction Adding I/O to Maude Motivation How it works in K Conclusions and Future Work Motivation Defining programming languages in the K framework In the K-Framework you can . . . ◮ . . . give operational semantics to a programming language. ◮ . . . run your semantics over programs defined in your language. Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 4/20

  5. Introduction Adding I/O to Maude Motivation How it works in K Conclusions and Future Work Motivation Defining programming languages in the K framework In the K-Framework you can . . . ◮ . . . give operational semantics to a programming language. ◮ . . . run your semantics over programs defined in your language. However. . . ◮ . . . Most programming languages are interactive ◮ . . . Requiring support for I/O in the framework. Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 4/20

  6. Introduction Adding I/O to Maude Motivation How it works in K Conclusions and Future Work Current status of I/O in Maude ◮ read-eval-print loop from LOOP-MODE standard module . . . may not be maintained in future versions, because the support for communication with external objects makes it possible to develop more general and flexible solutions for dealing with input/output in future releases. [Maude Manual] ◮ External objects? ◮ Currently, only socket communication is supported Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 5/20

  7. Introduction Adding I/O to Maude Motivation How it works in K Conclusions and Future Work In this paper ◮ Achieve interactive I/O executions within Maude ◮ Using the socket external object to emulate an I/O external object. Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 6/20

  8. Introduction Scenario Adding I/O to Maude Our solution How it works in K Maude I/O Interface Architecture Conclusions and Future Work Plan Introduction Motivation Adding I/O to Maude Scenario Our solution Maude I/O Interface Architecture How it works in K Conclusions and Future Work Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 7/20

  9. Introduction Scenario Adding I/O to Maude Our solution How it works in K Maude I/O Interface Architecture Conclusions and Future Work Scenario - Simple Expression Language mod EXP − SYNTAX is including INT . including STRING . sort Exp . op _ifnz_ : Exp Exp → Exp [ strat (2 0)] . subsort Int < Exp . op nzloop : Exp → Exp [ strat (0)] . op _+_ : Exp Exp → Exp [ditto] . op input : String → Exp . op _∗_ : Exp Exp → Exp [ditto ] . op print : String Exp → Exp . endm nzloop(print("3 ∗ x=",3 ∗ input("x= (0 to stop)? "))) Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 8/20

  10. Introduction Scenario Adding I/O to Maude Our solution How it works in K Maude I/O Interface Architecture Conclusions and Future Work Scenario - Simple Expression Language mod EXP − SYNTAX is including INT . including STRING . sort Exp . op _ifnz_ : Exp Exp → Exp [ strat (2 0)] . subsort Int < Exp . op nzloop : Exp → Exp [ strat (0)] . op _+_ : Exp Exp → Exp [ditto] . op input : String → Exp . op _∗_ : Exp Exp → Exp [ditto ] . op print : String Exp → Exp . endm nzloop(print("3 ∗ x=",3 ∗ input("x= (0 to stop)? "))) mod EXP − BASIC − SEMANTICS is including EXP − SYNTAX . eq nzloop(E: Exp ) = nzloop(E: Exp ) ifnz E: Exp . eq E: Exp ifnz 0 = 0 . eq E: Exp ifnz NzI: NzInt = E: Exp . endm Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 8/20

  11. Introduction Scenario Adding I/O to Maude Our solution How it works in K Maude I/O Interface Architecture Conclusions and Future Work Scenario - Simple Expression Language mod EXP − SYNTAX is including INT . including STRING . sort Exp . op _ifnz_ : Exp Exp → Exp [ strat (2 0)] . subsort Int < Exp . op nzloop : Exp → Exp [ strat (0)] . op _+_ : Exp Exp → Exp [ditto] . op input : String → Exp . op _∗_ : Exp Exp → Exp [ditto ] . op print : String Exp → Exp . endm nzloop(print("3 ∗ x=",3 ∗ input("x= (0 to stop)? "))) mod EXP − BASIC − SEMANTICS is including EXP − SYNTAX . eq nzloop(E: Exp ) = nzloop(E: Exp ) ifnz E: Exp . eq E: Exp ifnz 0 = 0 . eq E: Exp ifnz NzI: NzInt = E: Exp . endm Problem: How to give semantics to input/print ? Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 8/20

  12. Introduction Scenario Adding I/O to Maude Our solution How it works in K Maude I/O Interface Architecture Conclusions and Future Work Our solution Java Maude wrapper Maude + I/O J a v a I / O S e r v e r SOCKET ◮ Maude’s SOCKET external objects allow interaction ◮ We use this interaction to provide: ◮ a general client/server infrastructure to deal with I/O ◮ a “friendly” Maude interface to access this infrastructure Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 9/20

  13. Introduction Scenario Adding I/O to Maude Our solution How it works in K Maude I/O Interface Architecture Conclusions and Future Work Executing Scenario $ cat io-test-cmd.maude erew nzloop(print("3 ∗ x=",3 ∗ input("x= (0 to stop)? "))) . $ java -jar MaudeIO.jar --maudeFile io-test.maude --commandFile io-test-cmd.maude x= (0 to stop)? -12 3 ∗ x=-36 x= (0 to stop)? 0 3 ∗ x=0 Maude> ========================================== erewrite in KRUNNER : nzloop(print("3 ∗ x=", 3 ∗ input("x= (0 to stop)? "))) . rewrites: 6487 in 45ms cpu (53780ms real) (141396 rewrites/second) result Zero: 0 Maude> Bye. Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 10/20

  14. Introduction Scenario Adding I/O to Maude Our solution How it works in K Maude I/O Interface Architecture Conclusions and Future Work Maude Client STANDARD-IO TCP-CLIENT request: #readInt() 315#writebyte#1#97# #start #printString response: #toSend #eof 315#success# #TCPPORT ... #containedRequest request: ... 315#readbyte#0# SOCKET response: << uses >> 315#success#97# << uses >> #tcpRequest IO-INTERFACE TCP-INTERFACE ("readbyte#0#") #fReadToken #tcpRequest “97” #fPrintString #errorTCPSyntax #fEof #tcpRequest #checkResult #fOpen ("writebyte#0#97#") #getTCPData ... ... “success” Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 11/20

  15. Introduction Scenario Adding I/O to Maude Our solution How it works in K Maude I/O Interface Architecture Conclusions and Future Work STANDARD-IO Interface Basic console I/O operations op #printString : String → IOResult . op #printChar : Char → IOResult . op #readInt() : → IOResult . op #readChar() : → IOResult . op #eof() : → IOResult . op #readToken() : → IOResult . Andrei Arusoaie, Traian Florin S ¸erb˘ anut ¸˘ a, Chucky Ellison, Grigore Ro¸ su Making Maude Definitions more Interactive 12/20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend