diff options
author | dos-reis <gdr@axiomatics.org> | 2009-10-09 06:23:10 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-10-09 06:23:10 +0000 |
commit | b9b6081bee80b1eb8d4118983b03e29733f188e0 (patch) | |
tree | 3365be8261933f20b3e74d8955ee0fdd0b4b472b /src | |
parent | 8634da678944367834e85def966278aa3ae14026 (diff) | |
download | open-axiom-b9b6081bee80b1eb8d4118983b03e29733f188e0.tar.gz |
Fix SF/2875134
* interp/ptrees.boot: New.
(pfIdSymbol): Use it.
(pfSymbolSymbol): Likewise.
(pfInfApplication): Likewise.
* testsuite/interpreter/sf-2875134.input: New.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 9 | ||||
-rw-r--r-- | src/interp/ptrees.boot | 19 | ||||
-rw-r--r-- | src/testsuite/interpreter/sf-2875134.input | 3 |
3 files changed, 28 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b79e9778..e52b5851 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2009-10-09 Gabriel Dos Reis <gdr@cs.tamu.edu> + + Fix SF/2875134 + * interp/ptrees.boot: New. + (pfIdSymbol): Use it. + (pfSymbolSymbol): Likewise. + (pfInfApplication): Likewise. + * testsuite/interpreter/sf-2875134.input: New. + 2009-10-01 Gabriel Dos Reis <gdr@cs.tamu.edu> * driver/Makefile.in (open_axiom_LDADD): Prefer libraries from build diff --git a/src/interp/ptrees.boot b/src/interp/ptrees.boot index b31ef8c4..0359ce41 100644 --- a/src/interp/ptrees.boot +++ b/src/interp/ptrees.boot @@ -71,13 +71,25 @@ pfSemiColon(pfbody) == pfTree('SemiColon, [pfbody]) pfSemiColon?(pf) == pfAbSynOp? (pf, 'SemiColon) pfSemiColonBody pf == second pf -- was ==> +--% Renaming. +--% We decided that the identifier "^" is syntactically synonymous to "**". +--% We could have banned the later and support only the former. +--% However, that would have made all exponentiation examples from +--% the Jenks&Sutor book invalid. Which would be infortunate. +--% Rather, we opt to the renaming here. This poses the danger that +--% any other AST scheme would need to do the same work. +--% --gdr, 2009-10-08. +pfRename x == + x = "^" => "**" + x + --% LEAVES pfId(expr) == pfLeaf('id, expr) pfIdPos(expr,pos) == pfLeaf('id,expr,pos) pfId? form == pfAbSynOp?(form,'id) or pfAbSynOp?(form,'idsy) pfSymbolVariable? form == pfAbSynOp?(form,'idsy) -pfIdSymbol form == tokPart form +pfIdSymbol form == pfRename tokPart form --pfAmpersand(amptok,name) == name pfDocument strings == pfLeaf('Document, strings) @@ -106,7 +118,8 @@ pfSymb(expr, :optpos) == pfSymbol? form == pfAbSynOp?(form, 'symbol) -pfSymbolSymbol form == tokPart form + +pfSymbolSymbol form == pfRename tokPart form --% TREES -- parser interface functions @@ -127,7 +140,7 @@ pfInfApplication(op,left,right)== pfWrong(pfDocument ['"infop as argument to infop"],pfListOf []) pfIdSymbol op = "and" => pfAnd (left,right) pfIdSymbol op = "or" => pfOr (left,right) - pfApplication(op,pfTuple pfListOf [left,right]) + pfApplication(pfRename op,pfTuple pfListOf [left,right]) pfCheckInfop form== false diff --git a/src/testsuite/interpreter/sf-2875134.input b/src/testsuite/interpreter/sf-2875134.input new file mode 100644 index 00000000..88492a93 --- /dev/null +++ b/src/testsuite/interpreter/sf-2875134.input @@ -0,0 +1,3 @@ +f := series(1/(1-z), z=0) +f^3 + |