1 / 17

Generating readable programs from SDL

Institute for System Programming Department of CASE Systems. Alexei Ragozin Nikolai Mansurov. Generating readable programs from SDL. {ar,nick}@ispras.ru. Overview of presentation. Objectives of our project Example of generated code Techniques for generating readable programs

turnerjohn
Download Presentation

Generating readable programs from SDL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Institute for System Programming Department of CASE Systems Alexei Ragozin Nikolai Mansurov Generating readable programs from SDL {ar,nick}@ispras.ru Institute for System Programming, Moscow

  2. Overview of presentation • Objectives of our project • Example of generated code • Techniques for generating readable programs • Start-up time of generated program • Quality metrics of generated code • Conclusions Institute for System Programming, Moscow

  3. Objectives • What? • Automatic generation of readable programs from SDL-92 Readable = preserving appearance of original SDL specification • Why? • Research in new code generation techniques: • What are the properties of semantic-preserving mappings between two formal languages • How to synthesize target programs with given structural qualities • Readable generated code will lead to wider use of SDL code generators in industry Institute for System Programming, Moscow

  4. Example SDL PROCESS Ping; TIMER Tmr; DCL Count INTEGER; START; ... STATE Wait; ... ENDSTATE; ENDPROCESS Ping; Institute for System Programming, Moscow

  5. Example (cont.) C++ SDL PROCESS_DECL(PING); TIMER_DECL0(TMR); DCL(COUNT,int); STATE_LIST STATE_DECL(WAIT); END_STATE_LIST ENDPROCESS_DECL(PING); TIMER_DEF(TMR); PROCESS_DEF(PING) START; ... ENDSTART; STATE(WAIT); ... ENDSTATE; ENDPROCESS_DEF(PING); PROCESS Ping; TIMER Tmr; DCLCount INTEGER; START; ... STATE Wait; ... ENDSTATE; ENDPROCESS Ping; Institute for System Programming, Moscow

  6. Example (cont.) SDL START; TASK Count := 0; Lab : OUTPUT Ping; SET(NOW + 10, Tmr); NEXTSTATE Wait; Institute for System Programming, Moscow

  7. Example (cont.) SDL C++ START; TASK COUNT=0; LAB: OUTPUT(PING()); SET(NOW+10,TMR()); NEXTSTATE(WAIT); ENDSTART; START; TASK Count := 0; Lab : OUTPUT Ping; SET(NOW + 10, Tmr); NEXTSTATE Wait; Institute for System Programming, Moscow

  8. Example (cont.) SDL STATE Wait; INPUT Pong; RESET(Tmr); TASK Count := Count + 1; DECISION Count = 100000; (true) : OUTPUT Finish; STOP; else : JOIN Lab; ENDDECISION; INPUT Tmr; STOP; ENDSTATE; Institute for System Programming, Moscow

  9. Example (cont.) SDL C++ STATE(WAIT); INPUT(PONG,); RESET(TMR()); TASK COUNT = COUNT +1; DECISION(COUNT==100000); CASE( IS_EQUAL (COUNT==100000, TRUE )); OUTPUT(FINISH()); STOP; ELSE JOIN(LAB); ENDDECISION; INPUT(TMR,); STOP; ENDSTATE; STATE Wait; INPUT Pong; RESET(Tmr); TASK Count := Count + 1; DECISION Count = 100000; (true) : OUTPUT Finish; STOP; else : JOIN Lab; ENDDECISION; INPUT Tmr; STOP; ENDSTATE; Institute for System Programming, Moscow

  10. Code generation techniques Source program c2 c1 c3 expansion d2.1 d3 d1 d2.2 fragmentation domain Target program glue Institute for System Programming, Moscow

  11. Code generation techniques (cont.) gen macro STS RTS Source Indirect mappings gen STS RTS gen Direct mappings gen macro RTS gen RTS • gen - generated part of target program • macro - macro library • STS - start-up support • RTS - run-time support Institute for System Programming, Moscow

  12. Start-up time «Interpreter» Direct mapping RTS Run gen gen Run STS RTS gen Run STS Indirect mapping RTS Institute for System Programming, Moscow

  13. Start-up time (cont.) STS Macro library Generated code Macro library RTS Operating System Institute for System Programming, Moscow

  14. Quality metrics Expansion E = Vtarget/Vsrc (for a given program) Institute for System Programming, Moscow

  15. Quality metrics (cont.) • Structure transformation S =Rnosrc/Rsrc • Fragmentation F=1/n ni=1 Fi • Usage of names U =Utarget /Usrc (for a given program) Institute for System Programming, Moscow

  16. Quality metrics (cont.) Benchmark time Tbench (sec) Ping-Pong benchmark with 100 000 repeats. Platform SUN ULTRASPARC-1 (147 MHz) Institute for System Programming, Moscow

  17. Conclusions • Current state • Mapping: most SDL including SDL graph, structural types, inheritance, common cases of context parameters, excluding most SDL data • Implementation: prototype code generator for most of mapping • Generated code much more readable then produced by commercial code generators • Generated code is easily configurable, can be combined with legacy • There is no significant drop of performance of generated code Institute for System Programming, Moscow

More Related