I've thought about that sort of thing for a long time...=20 When translating ASCII text keywords into bytecode, my question is: Why can't the bytecode be ASCII and use symbols that relate to their function? This would give you the ability to directly code in the "bytecode" system without having or using a compiler / tokenizer and would make debugging muc= h easier. For example, why can't the bytecode for "IF" be "?"=20 [ WHILE=20 ] WEND { DO } LOOP & AND " PRINT Etc... Operations that don't relate to common ASCII punctuation marks can be translated to uppercase letters: P (Port) set SRC or DST to IO pins. E.g. 2P1 references pin 1 of port 2 H set last pin referenced (H)igh and make it an output=20 L set last pin referenced (L)ow and make it an output I set last pin referenced as an (I)nput. Read value to bit accumulator and set true flag if 1 Wdd (W)ait dd mSecs Wdddd (W)ait dddd uSecs http://techref.massmind.org/techref/piclist/cump/bytecode.htm The first variable used in the source code, which might be named "myData", could be tokenized as "a", the second as "b". Then you can still read them and have a way of translating that back to the variable name without any code between. If you leave some room between the actual register address defined by "a" and "b', such that "a" references register 0 and "b' references register 4, then multi-byte operations can be specified by a trailing length. So a:b3 copies register 4,5,6, and 7 to registers 0,1,2, and 3. If multibyte values are taken in LSB first (little endian) order, then a:b3+c3 actually moves a LONG at b to a then adds c as a LONG. If you work with the idea of every operation having a destination, operatio= n and source, and you don't execute the operations until one of those is specified more than once, or the line ends then you can make a "bytecode" that is easy to execute in the PIC and that is VERY human readable Examples: c:z@e-f+1 ;c is the e'th byte after z plus 1 less f 1P2L ;set port 1 pin 2 low a:0 ;clear a [ac?1P2H] ;once it reads a value higher than c (set prev) set pin high ;putting the wend on the line with the ? means it will only be executed if= =20 ;the condition is false, so we fall out when the desired minimum is read. a=3DFF?"Timeout! Input Level=3D"b The engine that executes those codes is actually very easy to write (I think) and is described here: http://techref.massmind.org/techref/idea/minimalcontroller.htm I think it could be made to fit into most of the PICs, if not the littlest ones. Different interpretations of the punctuation marks can be used to optimize for different functions. I think a compiler can be written in the same way: http://techref.massmind.org/techref/language/meta-l/index.htm -- James Newton 1-970-462-7764=20 -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Neil Cherry Sent: Sunday, January 02, 2011 16:02 To: Microcontroller discussion list - Public. Subject: Re: [PIC] P-code/Toeknizer So far I've managed to find at least one system that might be of interest, maybe two: http://darjeeling.sourceforge.net/ http://www.harbaum.org/till/nanovm/index.shtml And before anyone gets too excited, all I'm really doing nothing more than investigating an idea (I get lots of them). What I was thinking about was something like the BASIC Stamp stuff. Something with an Ethernet and easy to write quick code for. Something not too expensive. So far I'm meeting none of these goals. But it is getting closer. As usual it's for my home automation projects and before anyone gets too excited and suggest I build it myself I don't have the spare cycles. So far my mind is tied up on the main hardware/software architecture and sub-systems. I'll probably come back to this at a later date. --=20 Linux Home Automation Neil Cherry ncherry@linuxha.com http://www.linuxha.com/ Main site http://linuxha.blogspot.com/ My HA Blog Author of: Linux Smart Homes For Dummies --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .