Comments on: A Tiny Expression Language There is no rand() in the repository code, but it is trivial to add. The compiler doesn't allocate anything at all. The caller allocates a buffer for the bytecode and passes it to the compiler. You can read from the return value if the buffer was too small, so you can allocate a bigger buffer and recompile. But note that you should really do all the compilation in your "data compile" step, not in your runtime, and then it doesn't matter that much how efficient the compiler is. There is no rand() in the repository code, but it is trivial to add.

The compiler doesn’t allocate anything at all. The caller allocates a buffer for the bytecode and passes it to the compiler. You can read from the return value if the buffer was too small, so you can allocate a bigger buffer and recompile.

But note that you should really do all the compilation in your “data compile” step, not in your runtime, and then it doesn’t matter that much how efficient the compiler is.

]]>
By: Omar/2011/03/13/tiny-expression-language/#comment-1658 Omar Thu, 17 Mar 2011 07:00:53 +0000 I've updated the repository now. I’ve updated the repository now.

]]>
By: Niklas Frykholm/2011/03/13/tiny-expression-language/#comment-1576 Niklas Frykholm Mon, 14 Mar 2011 08:27:25 +0000 @Ricardo Yes it is easy to add new tokens and functions... just have a peek in the source code, you should be able to figure it out. I prefer Lua too, but this is intended for situations where calling into Lua would be prohibitively expensive, because of the overhead, looking up functions in _G, etc. Also, the expression VM requires very little code (only about 50 lines or so), touches only the very small memory buffers that are passed to it, does not malloc, etc. It could be run on SPUs or in other resource constrained environments. @Ricardo Yes it is easy to add new tokens and functions… just have a peek in the source code, you should be able to figure it out.

I prefer Lua too, but this is intended for situations where calling into Lua would be prohibitively expensive, because of the overhead, looking up functions in _G, etc. Also, the expression VM requires very little code (only about 50 lines or so), touches only the very small memory buffers that are passed to it, does not malloc, etc. It could be run on SPUs or in other resource constrained environments.

]]>
By: Tammo/2011/03/13/tiny-expression-language/#comment-1549 Tammo Sun, 13 Mar 2011 15:15:35 +0000 Nice parsers ... is easy add new tokens? (i prefer Lua ;P) Nice parsers … is easy add new tokens?

(i prefer Lua ;P)

]]>