Syntax

"if" Strategy "then" Strategy "end" -> Strategy

Description

The strategy

  if s1 then s2 end

applies s2 if s1 succeeds. The result of s1 is ignored. That is, if the condition

  <s1> t

succeeds, then the result of

  <if s1 then s2 end> t

is

  <s2> t

On the other hand, if the condition fails, then the result is t.

Formatting

The if-then construct is usually formatted in the following way:

  if s1 then
    s2
  end

Implementation

The if-then construct is sugar for a guarded left-choice. The strategy

  if s1 then s2 end

translates into

  where(s1) < s2 + id

Revision: r1.1 - 03 Oct 2004 - 11:29 - MartinBravenboer
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback