Skip to content

kwanghoon/iotacalculus

Repository files navigation

iotacalculus

프로그램 설치 방법

  • 하스켈 stack 설치
  •  $ git clone https://github.com/kwanghoon/iotacalculus
     $ git clone https://github.com/kwanghoon/yapb
     $ cd iotacalculus
     $ stack build
     $ stack exec -- iotacalculus-exe ./examples/turn-on-siren-when-no-one-is-present.iota 
    

iota 프로그램 구문 파싱 방법

iota 프로그램 실행 방법

  •  $ stack exec -- ghci
     ghci> :set -iapp
     ghci> :load Main
     ghci> Run.test1
     ...
     ghci> Run.test2
     ...
    
  • 실행 결과 (Run.test1)

    • turn-on-hallway-light-when-the-front-door-is-unlocked.iota

    • test1.txt

  • 실행 결과 (Run.test2)

    • turn-off-hallway-light-five-minutes-after-the-front-door-is-locked.iota

    • test2.txt

The grammar of Iota calculus

Program -> Rules | Rule

Rules -> rules string_literal 

               Decl1,  
               ..., 
               Deckn, 

               (Rule1 | Rules1), 
               ..., 
               (Rulek | Rulesk)
         end
         
         (where n>=0, k>=1)

Rule -> rule string_literal 
             Decl1,  
             ..., 
             Deckn, 
             
             EventHandler ; 
             
             MultiplePredicateActions 
        end

        (where n>=0)

Decl -> device identifier : 
          (identifier1 | identifier.identifier1) , 
          ... , 
          (identifierk | identifier.identifierk) ;

        (where k>=1)

Decl -> timer identifier ;

Decl -> input identifier : identifier ;

Decl -> output identifier : identifier ;

Decl -> output identifier : ( identifier1 , ... , identifierk ) ;

        (where k>=1)

EventHandler -> FieldOrTimer [ . ~> ]

EventHandler -> FieldOrTimer [ . ~> Constant ]

EventHandler -> FieldOrTimer [ Constant ~> ]

EventHandler -> FieldOrTimer [ Constant ~> Constant ]

EventHandler -> any Group ( identifier -> EventHandler )

MultiplePredicateActions -> 
       Predicate ;
       Action1 ,
       ...
       Actionj1

    | ...

       Predicatek ;
       Action1 ,
       ...
       Actionjk

   (where k>=1, j1>=1, ..., jk>=1)

Predicate -> Predicate [ || | && ] Predicate

Predicate -> all Group ( identifier -> Predicate )

Predicate -> exists Group ( identifier -> Predicate )

Predicate -> Expression

Expression -> Expression [ == | != | < | <= | > | >= | + | - | * | / ] Expression

Expression -> [ - | ! ] Expression

Expression -> true | false | number_literal | string_literal | identifier | identifier . identifier

Expression -> ( Expression )

Constant -> identifier | number_literal


Action -> FieldOrTimer := Expression

Action -> identifier ( Expression1 , ... , Expressionk )

   (where k>=1)

Action -> start identifier at Expression

Action -> stop identifier

Action -> map Group ( identifier -> Action )

FieldOrTimer -> identifier

FieldOrTimer -> identifier . identifier

Group -> identifier

Group -> { identifier1 , ... , identifiern }

    (where n>=1)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published