Author Topic: Lazy evaluation  (Read 2226 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Lazy evaluation
« on: March 03, 2011, 02:30:13 PM »
Deleted
« Last Edit: May 05, 2015, 09:38:49 AM by Peter »

Charles Pegge

  • Guest
Re: Lazy evaluation
« Reply #1 on: March 03, 2011, 04:54:47 PM »
Hi Peter.
I am glad to say we already have it  8)

It is a very simple implementation in the expressions() function which compiles all expressions (except metacode).

from src/o2expr.bas
Code: [Select]
 '
  '----------------
  'LAZY EVALUATIONS
  '================
  '
  if (nst=0)and(cnd<>0) then
    skiplspace(s,i)
    if (asc(wr)=rbr)and(stk.c=0)and(ascn=lbr) then
      '
      '
      'IF (A)AND(B) THEN ... always fail
      '---------------------------------
      '
      if op=33 then
        wt+="or "+qeax+cm+qeax+stp+"jz fwd _cnd"+cr
      end if
      '
      'IF (A)OR(B) THEN .. always succeed
      '----------------------------------
      '
      if op=34 then
        wt+="or "+qeax+cm+qeax+stp+"jnz fwd _cnd"+cr
      end if
      '
    end if
  end if
  '
  goto oploop
  '
  '

Charles
« Last Edit: March 03, 2011, 04:59:29 PM by Charles Pegge »