After reading A = B, I was inspired to experiment with symbolic computation.
I’m uploading this project in its current state because it took some effort to write a basic parser. Even if I proceed no further, at least I’ll have a complete example of a re-entrant Flex/Bison parser.
The 'main' program reads an expression from standard input or from the first command-line argument if present, and pretty-prints it:
$ ./main 'sin(x)*cos(y) + e^x; 1*2+3/4' +(*(sin(x), cos(y)), ^(e, x)) +─┬─*─┬─sin───x │ └─cos───y └─^─┬─e └─x +(*(1, 2), /(3, 4)) +─┬─*─┬─1 │ └─2 └─/─┬─3 └─4
See COPYING
for details.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA