Re: help with a logic algorithm

Liste des GroupesRevenir à cl c 
Sujet : Re: help with a logic algorithm
De : anton.txt (at) *nospam* gmail.moc (Anton Shepelev)
Groupes : comp.lang.c
Date : 07. Apr 2024, 02:58:46
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240407035846.47c1134be4066f90106de1fc@gmail.moc>
References : 1 2 3
User-Agent : Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Thiago Adams:

the algorithm is be used in flow analysis of C code.  I
realized my previous approach will not work because I also
need intermediate result.
>
for instance
>
if (p && p->i) {}
>
I need to know p is not-null after && , I cannot wait
until the end of expression. The algorithm must propagate
the results.  I am thinking on alternatives..

Then your original idea of analysing the expression tree is
good: the algorithm will be linear for conjunction and
negation, but will branch over disjunction. The short-
circuit evaluation may be accounted for by, eg., stroring
the known invariants with each node. For (a || b) you will
have:

OR
   a
   b [a is false]

yielding two branches: 1) a and 2) !a && b .

I do believe that waiting for the end of the expression
involves the chronology encoded in the expression tree.

--
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments

Date Sujet#  Auteur
2 Apr 24 * help with a logic algorithm13Thiago Adams
3 Apr 24 +* Re: help with a logic algorithm3Thiago Adams
3 Apr 24 i+- Re: help with a logic algorithm1jak
3 Apr 24 i`- Re: help with a logic algorithm1Thiago Adams
3 Apr 24 +- Re: help with a logic algorithm1Janis Papanagnou
3 Apr 24 +* Re: help with a logic algorithm5Anton Shepelev
3 Apr 24 i+- Re: help with a logic algorithm1Thiago Adams
3 Apr 24 i`* Re: help with a logic algorithm3Thiago Adams
4 Apr 24 i `* Re: help with a logic algorithm2Paul
5 Apr 24 i  `- Re: help with a logic algorithm1Anton Shepelev
4 Apr 24 `* Re: help with a logic algorithm3jak
4 Apr 24  `* Re: help with a logic algorithm2Thiago Adams
7 Apr 24   `- Re: help with a logic algorithm1Anton Shepelev

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal