🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6357

Info. needed on parsing expressions

#6357
From: System Hacker
Date: Sun, 26 Mar 1989 02:01
30 lines
1316 bytes
I need to parse a file which contains a set of arithmetic expressions
in normal format and build up an expression tree for use in my C program.
The tree need not be balanced.
For example, given the following expression in a file:-

x = a*b + c*(d + e);

The resulting tree would be:-
		 +
		/ \
               /   \
	      *     *
	    /  \    /\
           a    b  c  \
                       +
                       /\
                      d  e

Is there some utility package for doing this ?
Any information/help shall be greatly appreciated.

Thanks,
Arvind
EMAIL: sarvind@janus.Berkeley.EDU
--
----------------------------------------------------------------------------
"There is a certain power in mirth that only the jokers know"
EMAIL: jayneus@reliant.Berkeley.EDU
----------------------------------------------------------------------------
Technical Details
Message-ID: <JAYNEUS.89Mar25180103@reliant.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!jayneus

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!jayneus
From: jayneus@reliant.Berkeley.EDU (System Hacker)
Newsgroups: comp.lang.misc
Subject: Info. needed on parsing expressions
Message-ID: <JAYNEUS.89Mar25180103@reliant.Berkeley.EDU>
Date: 26 Mar 89 02:01:03 GMT
Sender: usenet@ucbvax.BERKELEY.EDU
Distribution: comp
Organization: University of California, Berkeley, CA, USA.
Lines: 30