01-19-2014, 01:02 AM
I have no idea how vector instructions work and how you want to use that language, can you provide a simple end-to-end example?
Brainstorming: Noise optimization
|
01-19-2014, 01:02 AM
I have no idea how vector instructions work and how you want to use that language, can you provide a simple end-to-end example?
So instead of something like:
Code: for (int i = 0; i < ArrayCount; i++) Code: @StartVectorCalc(ArrayCount,i,a_Array) The actual calculation being done with c++ operators. Results var and iteration var may be unnecessary but width is essential. The $ in front of Amplitude indicates its a scalar to avoid needing to do to much c++ parsing.
01-19-2014, 01:20 AM
I'm still not too convinced about Lua parsing, it is a big chunk of work to make Lua parse something, it's much easier to let it generate something out of data it already has. Is there any way we could represent the vector code as a Lua table, for example, and let Lua generate the C++ code out of that into a "vec_doThisThat.inc" file, then in the hand-maintained cpp file we would use #include "vec_doThisThat.inc" in places where we wanted the actual code to be inserted.
So, to sum up: vector_input.lua: GenerateCode = { vec_ThisThat = { -- Describe the calculation in a Lua table here }, ... } cNoise.cpp: void cCubicNoise::Generate1D(...) { // Prepare the data #include "vec_ThisThat.h" // Do some post-processing } As for Lua under Windows, there's still the possibility to abuse tolua++ when generating the bindings to execute this additional script as well.
01-19-2014, 01:34 AM
Sort of a lisp-style language. Why not just use lisp syntax because a lisp parser is easy and lisp syntax is slightly easier to read then lua object syntax when it comes to code.
01-19-2014, 01:45 AM
Because we don't want to bring yet another dependency to the code? Is there even a decent lisp interpreter for windows?
01-19-2014, 01:52 AM
Not actually in lisp, just lisp syntax. I can code a lisp parser reasonably quickly and then a lisp-like DSL on top of that as quickly as I can on lua tables.
01-19-2014, 02:05 AM
I fail to see the point of making an extra parser when you can represent the data reasonably well directly.
Thanks given by: bearbin
Just written one, probably full of bugs but should be easy to use. I'll push it to a branch if you want to see it. As for another reading the table syntax will be confusing:
Code: VectorFunction = { For most people writing lisp is hard enough, writing lisp in a DDL is even harder.
01-19-2014, 04:11 AM
At the moment
Code: a = b + c Code: (= a (+ b c)) |
« Next Oldest | Next Newest »
|