Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add recover_formula and prefix_to_infix functions to logicparser.py #15018

Closed
pscurek mannequin opened this issue Aug 7, 2013 · 23 comments
Closed

add recover_formula and prefix_to_infix functions to logicparser.py #15018

pscurek mannequin opened this issue Aug 7, 2013 · 23 comments

Comments

@pscurek
Copy link
Mannequin

pscurek mannequin commented Aug 7, 2013

In the patch for this ticket, the functions recover_formula and prefix_to_infix are added to logicparser.py in the logic module. The function recover_formula allows for the recovery of a boolean formula from its parse tree. The function prefix_to_infix converts a parse tree from prefix form to infix form. Here are some examples.

sage: import sage.logic.logicparser as logicparser
sage: t = ['->', ['~', 'a'], ['|', 'c', ['~', 'd']]]
sage: logicparser.recover_formula(t)
'~a->(c|~d)'
sage: import sage.logic.logicparser as logicparser
sage: t = ['->', ['~', 'a'], ['|', 'c', ['~', 'd']]]
sage: logicparser.prefix_to_infix(t)
[['~', 'a'], '->', ['c', '|', ['~', 'd']]]

Depends on #14951
Depends on #14952
Depends on #15013

Component: misc

Keywords: logic, logicparser, prefix, infix

Author: Paul Scurek

Branch/Commit: 521ba42

Reviewer: Frédéric Chapoton, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/15018

@pscurek pscurek mannequin added this to the sage-6.1 milestone Aug 7, 2013
@pscurek pscurek mannequin added p: major / 3 labels Aug 7, 2013
@pscurek
Copy link
Mannequin Author

pscurek mannequin commented Aug 7, 2013

Attachment: trac_14951_tokenize_tree_fix.patch.gz

apply first

@pscurek
Copy link
Mannequin Author

pscurek mannequin commented Aug 7, 2013

Attachment: trac_14952_logic_if_while_syntax.patch.gz

apply second

@pscurek
Copy link
Mannequin Author

pscurek mannequin commented Aug 7, 2013

apply third

@williamstein
Copy link
Contributor

comment:2

Attachment: trac_15013_logic_docstrings.patch.gz

Referee:

  • trivial typo: "argrument" (in multiple places!)

  • delete parens here: "prefix_to_infix() takes a parse tree as input"

  • Someday somebody should change this... type(tree[1]) is ListType to isinstance(tree[1], list).

That's it.

@pscurek
Copy link
Mannequin Author

pscurek mannequin commented Aug 15, 2013

Apply this last. This is the patch for this ticket, but depends on the previous 3.

@pscurek
Copy link
Mannequin Author

pscurek mannequin commented Aug 15, 2013

Attachment: trac_15018_recover_formula.2.patch.gz

This file is the same as trac_15018_recover_formula.2.patch.

@pscurek
Copy link
Mannequin Author

pscurek mannequin commented Aug 15, 2013

comment:3

Attachment: trac_15018_recover_formula.patch.gz

I forgot to check the box for replacing the file with the same name. That is why there are attachments called trac_15018_recover_formula.patch and trac_15018_recover_formula.2.patch. They are exactly the same, so only apply one of them when testing the patch. I would get right of one of them, but I don't see an option for removing attachments.

@pscurek pscurek mannequin added the s: needs review label Aug 15, 2013
@pscurek
Copy link
Mannequin Author

pscurek mannequin commented Aug 20, 2013

comment:5

The last patch listed in the attachments, trac_15018_recover_formula.patch, is the only patch that should be integrated into sage for this ticket. The first three patches are the patches from the dependencies for this ticket that were placed here for the convenience of the reviewer. The patch, trac_15018_recover_formula.2.patch is identical to trac_15018_recover_formula.patch.

@vbraun
Copy link
Member

vbraun commented Dec 21, 2013

comment:6

First patch of the series does not apply any more, please fix.

@tscrim
Copy link
Collaborator

tscrim commented Jan 30, 2014

Commit: 86e7f6e

@tscrim
Copy link
Collaborator

tscrim commented Jan 30, 2014

Branch: public/ticket/15018

@tscrim
Copy link
Collaborator

tscrim commented Jan 30, 2014

comment:7

I've rebased this and made some minor doc changes. If everything is good, then positive review.


New commits:

9798dcaTrac 15018: added recover_formula, recover_formula_internal, prefix_to_infix, and to_infix_internal to logicparser.py
22ec476Minor review tweaks.
bb23f1bMerge branch 'develop' into public/ticket/15018
86e7f6eMerge branch 'develop' into public/ticket/15018

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@fchapoton
Copy link
Contributor

Work Issues: needs rebase

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 10, 2014

Changed commit from 86e7f6e to b4e8f25

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 10, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

b4e8f25Merge branch 'public/ticket/15018' of trac.sagemath.org:sage into public/ticket/15018

@tscrim
Copy link
Collaborator

tscrim commented May 10, 2014

Changed work issues from needs rebase to none

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 11, 2014

Changed commit from b4e8f25 to 521ba42

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 11, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

521ba42change raise syntax to python3 style

@fchapoton
Copy link
Contributor

comment:14

looks good to me, positive review.

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@tscrim
Copy link
Collaborator

tscrim commented May 11, 2014

Changed reviewer from Frédéric Chapoton to Frédéric Chapoton, Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented May 11, 2014

comment:15

Thanks Frederic.

@vbraun
Copy link
Member

vbraun commented May 12, 2014

Changed branch from public/ticket/15018 to 521ba42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants