Open katat opened 2 weeks ago
I think being able to write log("this is a {var} and this is another {var2}");
like in javascript would be cool
a third feature request would be to make it work with any types (array, structs, etc.) not just field types
Would like to try this, although I might need some guidance.
Can I try taking this?
correct me if I'm wrong @katat but a first PR could just add support for string literals in the lexer/parser logic, so you can write things like let some_string = "some string!";
correct me if I'm wrong @katat but a first PR could just add support for string literals in the lexer/parser logic, so you can write things like let some_string = "some string!";
It would also need to encode the string literal, so they can be passed around. I think it can be similar to how the literal boolean and ints are encoded.
For both ints and booleans, they are represented by a single field. For string literals, they could be represented by an array of fields, each of which represent an ASCII code (a character of a string).
Sounds good! @cwkang1998
The recent addition allows printing out variable values via
log(var)
builtin function.However, it only supports the R1CS backend atm. Also, because noname doesn't support the string type variable yet, the
log
stdlib can't take a string argument to customize the message per logging output.It would be very nice to have the following enhancements:
Implement the log_var function for the kimchi backend. For reference, please check how the logging is implemented in R1CS backend.
Support parsing strings in native code, so a customized logging message can be passed to the logging function. At this stage, we may just implement a builtin string type (read only) in order to pass to the
log
function. Later, we can extend this string type to be able to encoded in the circuit.