ПРЕДМЕТНО-ОРИЕНТИРОВАННЫЙ ЯЗЫК АВТОМАТНОГО ПРОГРАММИРОВАНИЯ НА БАЗЕ ДИНАМИЧЕСКОГО ЯЗЫКА RUBY

  • View
    216

  • Download
    1

Embed Size (px)

Transcript

  • 4, 2007

    22

    681.3.06

    RUBY

    . . ,. . ,. . ,. . ,. . , JetBrains s. r. o.. . . . . . . . . . , . , . . ,. . ,. . ,. . ,. . ,. . , ,

    , SWITCH, . , , . Ruby STROBE .

    This paper solves the problem of transforming transition diagrams used in SWITCH technology intoexecutable code. We suggest using dynamic programming languages to solve this problem becausethese languages allow to achieve an isomorphism between the source diagram and the resulting code.This leads to decreasing the number of errors that appear during such transition. We also present anextension library STROBE and a domainspecific automata programming language based on the dynamicprogramming language Ruby.

    SWITCH, [1]. , .

    SWITCH , , . , , , ( ),

    / . , , . , .

    .

    1. . : switch, [2]. State [3].

  • 4, 2007 23

    , : .

    2. . , . :

    , , , Java;

    , ( );

    ;

    , (, Visio [4], XML [5, 6]).

    3. . , . . , ( , , ). , . , , , . :

    (, , , [7, 8], );

    , .

    . , . , , , .

    . :

    , Ruby. (Domain Specific Language DSL [9]);

    , , ;

    . STROBE ( , , , , , . .) ;

    .

    ( ) . .

    : . , . STROBE, .

    , , , , .

    . [10] , (A11). .

    : ( ), ( ) ( ). ( e11), e4 ( ),

  • 4, 200724

    e3 ( ) , ( x61).

    . UML , [11, 12].

    .

    1. .

    2. , . .

    3. , (, , ). . .

    4. :

    ; (

    ); ; (

    , ).5.

    : ; ; .

    : , ( ). , . :

    ei , i , ( e0 );

    xi xi; yi Ai. ,

    . :

    ( zi );

    , ;

    , ;

    : , , e0.

    A11.

    1. e11, . z111 ( ).

    2. , e3 x61 , . z110( ).

    3. e4, .

    Ruby

    [13]. , ,:

    ; (

    , http://en.wikipedia.org/wiki/Closure_%28computer_science%29).

    . .

    . .

    Ruby [13],

    0. 1.

    2.

    11

    z111

    4

    z110 3&x61

  • 4, 2007 25

    (Yukihiro Matsumoto). :

    ( );

    ; ; (http://ru.wikipedia.org/

    wiki/Mixin), ;

    ; ( Ruby

    );

    .

    STROBE . Ruby. ( ), ( , ,state transition ). ( ). . , , :to :output_actions.

    , A11:

    # STROBErequire strobe/automatonmodule Elevator # class A11 < Strobe::Automaton # x61 attr_accessor :x61 # inputs :e3, :e4, :e11 # outputs :z110, :z111 # begin_group # state :ready # transition :to => :on, :if => lambda { e11 } # state :on, :output_actions => :z111 # group_transition :to => :off, :if => lambda { e3 && x61 } end_group # state :off, :output_actions => :z110

    # transition :to => :ready, :if => lambda { e4 } endend

    A11. Strobe::Automaton. A11.

    inputs, outputs, state,transition group_transition , , . begin_group end_group .

    Ruby

    , Ruby.

    .1.

    , .

    2. , , . :

    , ;

    .

    3. .

    Ruby , . . , ,

    e1 e0 (x1 (y2 = 3)).

    e1 || e0 && (x1 || (y2 == 3)).

    , e0, e1, x1 y2. y2 == 3 ,

  • 4, 200726

    , .

    :

    , , , ;

    , ;

    , y . .

    :

    ;

    ;

    yi;

    , ;

    .

    STROBE, .

    STROBE STROBE

    Ruby , . , . .

    STROBE .

    1. ( , ) .

    2. , .

    3. .

    4. .

    5. (yi) .

    6. .

    , . , . , , .

    ( ). , .

    , SWITCH, . , . ( [14]) Ruby. : ( ) . , , Ruby, .

    1. . . SWITCH. . .: , 1998. 628 . http://is.ifmo.ru/books/switch/1

    2. . ., . . //

    . 2002. 4. .7480. http://is.ifmo.ru/works/evsys/

    3. ., ., ., . . . .: , 2001.368 .

  • 4, 2007 27

    4. Visio2SWITCH. http://is.ifmo.ru/progeny/visio2switch/

    5. State Chart XML (SCXML): State Machine Notationfor Control Abstraction 1.0. http://www.w3.org/TR/2005/WDscxml20050705/

    6. UniMod. http://unimod.sourceforge.net

    7. The Boost C++ Metaprogramming Library. www.mywikinet.com/mpl/paper/mpl_paper.pdf

    8. . ., . . // . 2003. 5. . 2939. http://is.ifmo.ru/works/ooaut/

    9. ., . . , , ..: , 2005.

    10. . ., . . . /

    . ., 2003. http://is.ifmo.ru/projects/elevator/

    11. . ., . ., . . UML Unimod // . . 2005 / .., 2005. http://tm.ifmo.ru/tm2005/src/224as.pdf

    12. . . / . ., 2006. http://is.ifmo.ru/papers/statec/

    13. Thomas D., Fowler C., Hunt A. Programming Ruby.Second Edition. Pragmatic Bookshelf, 2004.

    14. . . : . / . .,2006. http://is.ifmo.ru, .

    . . :

    . .: , 2007.548 .: .

    ISBN 5732508813

    , . , . , , . .

    : , , , , .

    :191023, . , . , . 6, 3 , /: (812) 3124495 ( )