///////////////////////////////////////////////////////////////////////////////
//                             Lisaac Compiler                               //
//                                                                           //
//                   LSIIT - ULP - CNRS - INRIA - FRANCE                     //
//                                                                           //
//   This program is free software: you can redistribute it and/or modify    //
//   it under the terms of the GNU General Public License as published by    //
//   the Free Software Foundation, either version 3 of the License, or       //
//   (at your option) any later version.                                     //
//                                                                           //
//   This program is distributed in the hope that it will be useful,         //
//   but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
//   GNU General Public License for more details.                            //
//                                                                           //
//   You should have received a copy of the GNU General Public License       //
//   along with this program.  If not, see <http://www.gnu.org/licenses/>.   //
//                                                                           //
//                     http://isaacproject.u-strasbg.fr/                     //
///////////////////////////////////////////////////////////////////////////////
Section Header
  
  + name        := EXPR_AND_LOGIC;

  - copyright   := "2003-2007 Benoit Sonntag";

  
  - author      := "Sonntag Benoit (bsonntag@loria.fr)";
  - comment     := "And binary logical expression.";
  
Section Inherit
  
  + parent_expr_binary_logic:Expanded EXPR_BINARY_LOGIC;
  
Section Public  
  
  + symbol:STRING_CONSTANT := "&";
  
  //
  // Execute.
  //
      
  - exec_conservator_left  left_cst :TYPE :EXPR <- 
  //-- TRUE & E -> E
  ( + result:EXPR;
    
    (left_cst = type_true).if {
      result := right;
      left.remove;
    };
    result
  );
  
  - exec_conservator_right right_cst:TYPE :EXPR <- 
  //-- E & TRUE -> E
  ( + result:EXPR;
    
    (right_cst = type_true).if {
      result := left;
      right.remove;
    };
    result
  );
    
  - exec left_cst:TYPE and right_cst:TYPE :EXPR <-
  //-- C1 & C2 -> C3
  ( + result:EXPR;
    
    (left_cst = type_true).if {
      result := right;
      left.remove;
    } else {
      result := left;
      right.remove;
    };
    result
  );
  
  - exec:EXPR <-   
  //-- E & E -> E
  ( + result:EXPR;
        
    (left == right).if {
      result := left;
      right.remove;
    };
    result      
  );

  - exec_left  left_cst :TYPE :EXPR <- 
  //-- FALSE & E -> FALSE
  ( + result:EXPR;
    
    (left_cst = type_false).if {
      result := left;
      right.remove;
    };
    result
  );
  
  - exec_right right_cst:TYPE :EXPR <- 
  //-- E & FALSE -> FALSE
  ( + result:EXPR;
    
    (right_cst = type_false).if {
      result := right;
      left.remove;
    };
    result
  );

  
  
  
  
  
  
  
  
  
  








