I was just going through a few of the courses at Udacity.com, and in CS212, Unit 3, the instructor describes how to create a parse tree in the Python programming/scripting language, as well as how to write the grammar and grammar interpreter. If you already understand regular expressions and Python, you can begin at part 38 "Writing Grammar" of Unit 3.

Udacity also has an AI course which resembles what I took as a real college class.

On 1/1/2013 2:53 PM, Piaget Modeler 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/10215994-5ed4e9d1> | Modify <https://www.listbox.com/member/?&;> Your Subscription [Powered by Listbox] <http://www.listbox.com>



____________________________________________________________

____________________________________________________________
Woman is 57 But Looks 27
57-Year-Old Mom has a simple facelift trick that angered doctors...
http://thirdpartyoffers.juno.com/TGL3141/50e4780c8aceb780b38d1st03duc


-------------------------------------------
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

Reply via email to