Acme-AlgebraicToRPN
view release on metacpan or search on metacpan
lib/Acme/AlgebraicToRPN.pm view on Meta::CPAN
package Acme::AlgebraicToRPN;
use warnings;
use strict;
our $VERSION = '0.02';
=head1 NAME
Acme::AlgebraicToRPN - convert algebraic notation to sane RPN
=head1 VERSION
Version 0.02
=head1 SYNOPSIS
$rpn = Acme::AlgebraicToRPN->new;
@RPN = $rpn->eval($equation);
=head1 DESCRIPTION
Given a string with algebraic notation, convert to RPN, which is
what any crappy dime store calculator needs to do anyway.
Doesn't really process anything, that's up to you. You will get an
array back with all of the variables and operations in RPN format.
So that 3+4 will come back as
3
4
add
Possible future extensions will be to allow you to actually process
this via hooks that allow specifications of how to handle foreign
functions. But for my purposes, the array is good enough, as I am
passing this on to a C program to do some serious number crunching.
Additionally, you can specify (via the constructor) the names of
your own functions. See below.
=head1 ACKNOWLEDGEMENT
The Hewlett Packard Company and the HP 35, my first real calculator,
and Steffen Mueller for the Math::Symbolic code.
=head1 AUTHOR
X Cramps, C<< <cramps.the at gmail.com> >>
=head1 BUGS
Please report any bugs or feature requests to
C<bug-acme-algebraictorpn at rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-AlgebraicToRPN>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Acme::AlgebraicToRPN
You can also look for information at:
=over 4
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Acme-AlgebraicToRPN>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/Acme-AlgebraicToRPN>
=item * RT: CPAN's request tracker
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-AlgebraicToRPN>
=item * Search CPAN
L<http://search.cpan.org/dist/Acme-AlgebraicToRPN>
=back
=head1 ACKNOWLEDGEMENTS
=head1 COPYRIGHT & LICENSE
Copyright 2009 X Cramps, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
package Acme::AlgebraicToRPN;
use strict;
use warnings;
use Regexp::Common;
use Perl6::Attributes;
use Math::Symbolic;
use Math::SymbolicX::ParserExtensionFactory;
=head2 B<new>
$al = Acme::AlgebraicToRPN->new(%opts);
%opts (optional) can be:
userFunc - user functions, as array reference
( run in 1.490 second using v1.01-cache-2.11-cpan-59e3e3084b8 )