I even have forth running on my HP 200lx palm top -----Original Message----- From: Tal [mailto:tal@ZAPTA.COM] Sent: Friday, May 30, 2003 9:45 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: Parser If you are implementing a stack oriented interpreter, you may want to take look at the lagnuage Forth (used to be very hot about 15 ago). Take a look at the operators they use for expressions, stack manipulation, flow control, etc. This will give you some ideas. I presume you can also get a free implementation of Forth and play with it. http://www.forth.org/ Tal > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Spehro Pefhany > Sent: Friday, May 30, 2003 5:57 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Parser > > > At 12:12 PM 5/30/2003 +0200, you wrote: > > > You can implement what you want as bytecode in the eeprom and a > > > bytecode interpreter that runs in the pic and executes > it. Eg. for > > > the expression above it would be in byte code something > like (after > > > correcting the & in the middle to && which is likely what you > > > wanted): > > > > > > !fetch var1 !fetch var2 !and !sgn !fetch var3 !literal > > > 0x0C !sub !sgn !and !if !literal DoSomething !acall !fi > > > > > > where each word would take one EEPROM cell or more (you > can compress > > > some of it). > > > >Ok, It sounds cool! > >Instead of coding a complex parser it would be a good idea > to store in > >eeprom some commands like you explained. To do 'If ((Var1 & > >Var2)&(Var3<0x0C))' I will store in eeprom something like: > > Yes, the parsing could be done off-line on a PC and a > simulated stack machine could be coded on the PIC using > bytecodes/tokens stored in the EEPROM. I've done this (not > with a PIC, but it's no different). > > Best regards, > > Spehro Pefhany --"it's the network..." "The > Journey is the reward" > speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body