Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Parsing Boolean expressions

by Anonymous Monk
on Apr 23, 2017 at 14:41 UTC ( [id://1188684]=note: print w/replies, xml ) Need Help??


in reply to Re: Parsing Boolean expressions
in thread Parsing Boolean expressions

The OP is asking for a module. I think whatever output format that module uses will probably be fine.

Replies are listed 'Best First'.
Re^3: Parsing Boolean expressions
by LanX (Saint) on Apr 23, 2017 at 17:26 UTC
    > I think whatever output format that module uses will probably be fine.

    well then ... taking output from Re: Parsing Boolean expressions (hack)

    $ perl -MO=Terse -e ' $Y = ( $A or ($B^1 or ($C and $D)^1) );' LISTOP (0x8570520) leave [1] OP (0x85a2968) enter COP (0x856fff8) nextstate BINOP (0x8570500) sassign UNOP (0x85704e0) null LOGOP (0x85704c0) or UNOP (0x856ffb8) null [15] PADOP (0x8570050) gvsv GV (0x856a758) *A UNOP (0x85704a0) null LOGOP (0x8659ee0) or BINOP (0x856ff78) bit_xor [4] UNOP (0x856ff58) null [15] PADOP (0x856ff38) gvsv GV (0x856a7bc) + *B SVOP (0x856ff08) const [8] IV (0x856a71c) +1 BINOP (0x8659ec0) bit_xor [7] UNOP (0x8659e80) null LOGOP (0x8659e60) and UNOP (0x8570180) null [15] PADOP (0x85700c8) gvsv GV (0x +856a7a8) *C UNOP (0x8659e40) null [15] PADOP (0x859fd50) gvsv GV (0x +856a7e4) *D SVOP (0x8659ea0) const [9] IV (0x856a7d0) +1 UNOP (0x8570140) null [15] PADOP (0x856edd8) gvsv GV (0x856a730) *Y

    et voila! ;-P

    And see B::Concise for even more formating options.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Does B:: provide a way to look at the optree directly, or do you have to dump it to text and reparse?
        These modules like B::Deparse and B::Concise are implemented in Perl and use B to "walk" the optree and generate the text output.

        Just peek into the code to see how.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Re^3: Parsing Boolean expressions
by LanX (Saint) on Apr 23, 2017 at 15:40 UTC

      hehehe

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1188684]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found