OK, just finished a C version (Hi-Tech PICC) of my ancient expression parser: I has operator precedence and variables and doesn't use recursion in the C code (thus PIC worthy). No unary operators or parenthesis yet. For now only +, -, *, /, % (mod), &. Only 1320 FLASH words in a PIC16F648A with printf, and 774 FLASH words without printf. I made it just for fun, I hope it is useful for somebody. Let the flames begin... Regards, Isaac Forrest W Christian escreveu: > I've got a temperature control application where I'd like to be able to = > let the customers enter expressions (via serial) like: > > T1>T2&T1>72 > > or > > T1>T2+5&T2<32 > > Where T1 and T2 are temperature readings from a thermocouple. The = > result of these expressions will be used to turn on and off fans and/or = > heaters in an application I am working on. I could hardcode a lot of = > options, but I think some simple customer-modfiable rules would be best = > in this particular application. = > > So, before I write my own parser and the like I figured I'd ask if = > there's code out there which would be suited for this, and is small (the = > target is a PIC16F886 and CCS C - and it's not easy to change it in this = > application). > > I've found some example code but it's all overly big and not well suited = > to what I'm looking for. I know how to write this myself, but I'd = > rather just use some existing code - or perhaps hear some other ideas. > > Oh, I really only need a few variables (I'll probably use TA, TB instead = > of T1, T2 just to simplify parsing), a few boolean functions (and, or, = > greater than, less than, maybe >=3D or <=3D), and possibly addition, = > subtraction, and less possibly multiplication and/or division. > > -forrest > = __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist