Skip to content

Commit

Permalink
Add units to dsl-parser terms.
Browse files Browse the repository at this point in the history
  • Loading branch information
anmaped committed Jan 23, 2024
1 parent ac16c89 commit c85001d
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/interface/dsl-parser/ast.mli
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ and interval =

and tm =
| Constant of value
| C of time * units
| FPlus of tm * tm
| FTimes of tm * tm
| Duration of interval * fm
1 change: 1 addition & 0 deletions src/interface/dsl-parser/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,6 @@ term:

%inline term_atom:
| c = NUM { Constant( float_of_string c) }
| t = TIME { Constant( float_of_string (fst t)) }

%%
88 changes: 88 additions & 0 deletions src/interface/dsl-parser/parserMessages.messages
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,32 @@ main: DURATION OF FALSE IN LSQPAR NUM WITHIN

The exp. is incomplete. The correct exp. is: "duration of" <F> "in" "[" <I> "," <I> "]"

main: DURATION OF FALSE IN TIME WITHIN
##
## Ends in an error in state: 79.
##
## term -> DURATION OF formula IN TIME . DOTS NUM [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
## term -> DURATION OF formula IN TIME . DOTS TIME [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
##
## The known suffix of the stack is as follows:
## DURATION OF formula IN TIME
##

Ill-formed expression.

main: DURATION OF FALSE IN TIME DOTS WITHIN
##
## Ends in an error in state: 80.
##
## term -> DURATION OF formula IN TIME DOTS . NUM [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
## term -> DURATION OF formula IN TIME DOTS . TIME [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
##
## The known suffix of the stack is as follows:
## DURATION OF formula IN TIME DOTS
##

Ill-formed expression.

main: DURATION OF FALSE IN LSQPAR NUM COMMA WITHIN
##
## Ends in an error in state: 78.
Expand Down Expand Up @@ -763,6 +789,56 @@ main: DURATION OF FALSE IN NUM DOTS WITHIN

The exp. is incomplete. The correct exp. is: "duration of" <F> "in" <I> ".." <I>

main: DURATION OF FALSE IN LSQPAR TIME WITHIN
##
## Ends in an error in state: 88.
##
## term -> DURATION OF formula IN LSQPAR TIME . COMMA NUM RSQPAR [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
## term -> DURATION OF formula IN LSQPAR TIME . COMMA TIME RSQPAR [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
##
## The known suffix of the stack is as follows:
## DURATION OF formula IN LSQPAR TIME
##

Ill-formed expression.

main: DURATION OF FALSE IN LSQPAR TIME COMMA WITHIN
##
## Ends in an error in state: 89.
##
## term -> DURATION OF formula IN LSQPAR TIME COMMA . NUM RSQPAR [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
## term -> DURATION OF formula IN LSQPAR TIME COMMA . TIME RSQPAR [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
##
## The known suffix of the stack is as follows:
## DURATION OF formula IN LSQPAR TIME COMMA
##

Ill-formed expression.

main: DURATION OF FALSE IN LSQPAR TIME COMMA TIME WITHIN
##
## Ends in an error in state: 90.
##
## term -> DURATION OF formula IN LSQPAR TIME COMMA TIME . RSQPAR [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
##
## The known suffix of the stack is as follows:
## DURATION OF formula IN LSQPAR TIME COMMA TIME
##

Ill-formed expression.

main: DURATION OF FALSE IN LSQPAR TIME COMMA NUM WITHIN
##
## Ends in an error in state: 92.
##
## term -> DURATION OF formula IN LSQPAR TIME COMMA NUM . RSQPAR [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
##
## The known suffix of the stack is as follows:
## DURATION OF formula IN LSQPAR TIME COMMA NUM
##

Ill-formed expression.

main: PREV FALSE UNTIL
##
## Ends in an error in state: 86.
Expand All @@ -787,6 +863,18 @@ main: PREV FALSE WITHIN WITHIN

The exp. is incomplete. The correct exp. is: "previous" <F> "within" <C>

main: DURATION OF FALSE IN LSQPAR NUM COMMA TIME WITHIN
##
## Ends in an error in state: 96.
##
## term -> DURATION OF formula IN LSQPAR NUM COMMA TIME . RSQPAR [ WITHIN UNTIL TIMES SINCE RPAR PLUS OR LESSOREQUAL LESS IN IMPLIES GREATEROREQUAL GREATER EOF AND ]
##
## The known suffix of the stack is as follows:
## DURATION OF formula IN LSQPAR NUM COMMA TIME
##

Ill-formed expression.

main: LPAR NUM WITHIN
##
## Ends in an error in state: 91.
Expand Down
1 change: 1 addition & 0 deletions src/interface/dsl-parser/translateToRmtld3.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ let conv_kind = function

let rec conv_tm : tm -> Rmtld3.tm = function
| Constant (x) -> Constant (x)
| C (t,u) -> Constant ( ((conv_time t) |> float_of_int) /. ((conv_u u) |> float_of_int) )
| FPlus (a,b) -> FPlus (conv_tm a, conv_tm b)
| FTimes (a,b) -> FTimes(conv_tm a, conv_tm b)
| Duration (i,f) -> Duration (conv_interval i, conv_fm f)
Expand Down

0 comments on commit c85001d

Please sign in to comment.