Looks to me like lex/yacc, or equivalent tools in your favorite programming language, would handle this well?
On Tue, Jan 1, 2013 at 8:53 PM, Piaget Modeler <[email protected]>wrote: > > > Hello all, > > I'm attempting to create parse trees for user input to the following > simple grammar: > > > *term := number | moment | string | symbol | scheme | collection* > * > * > *number := #nnnn.nnn -- where n is a > digit.* > * > * > *moment := @nnnnnnnnnnnnnnnn -- where n is a digit* > * > * > *string := $[ccccccc] -- where c > is a character* > * > * > *symbol := cccccccc -- where c is > a character* > * > * > *slot := ccccccccc ** -- where > c is a character* > * > * > *scheme := positional | slotted * > * > * > *positional := symbol( term* ) -- where term **is > zero or more & slot** * > * > * > *slotted := symbol(slot:term* ) -- where slot & term > pair is one or more.* > * > * > *collection := sequence | concurrence | choice | cycle* > * > * > *sequence := [ term* ] -- where [ ] > are delimiters* > * > * > *concurrence := ( term* ) -- where ( ) > are delimiters* > * > * > *choice := { term* } -- where { } > are delimiters* > * > * > *cycle := < term* > -- where < > > are delimiters* > > > After an input expression is parsed and a parse tree is generated, I'd > like to be able to: > > (1) query the parse tree against a database > > (2) merge the parse tree into the database. > > > Other requirements: The parse itself should be on the order of > milliseconds. > > Your thoughts on approaches or tools is appreciated? > > > ~PM > > > > > ------------------------------------------------------------------------------------------------------------------------------------------------ > *Confidential *- *This message is meant solely for the intended > recipient. Please do not copy or forward this message without * > *the consent of the sender. If you have received this message in error, > please delete the message and notify the sender.* > *AGI* | Archives <https://www.listbox.com/member/archive/303/=now> > <https://www.listbox.com/member/archive/rss/303/1658954-f53d1a3f> | > Modify<https://www.listbox.com/member/?&>Your Subscription > <http://www.listbox.com> > ------------------------------------------- AGI Archives: https://www.listbox.com/member/archive/303/=now RSS Feed: https://www.listbox.com/member/archive/rss/303/21088071-f452e424 Modify Your Subscription: https://www.listbox.com/member/?member_id=21088071&id_secret=21088071-58d57657 Powered by Listbox: http://www.listbox.com
