pepper-project / pequin

A system for verifying outsourced computations, and applying SNARKs. Simplified release of the main Pepper codebase.
Other
122 stars 46 forks source link

concatenation of string literals not supported #57

Open noresistence opened 5 years ago

noresistence commented 5 years ago

Concatenation of adjacent string literals apparently is not supported, but legal c and quite helpful in some circumstances.

example.c

struct In {int in;};
struct Out {int out;};

void compute(struct In *input, struct Out *output) {
    printf("VAR: " "4");
}

compiler output

Compiling example.c
Exception in thread "main" java.lang.RuntimeException: Unexpected ""4""
        at ccomp.parser.CParser$208.syntaxError(CParser.java:1757)
        at beaver.Parser.parse(Parser.java:394)
        at beaver.Parser.parse(Parser.java:352)
        at ccomp.parser_hw.CCompiler.compileProgram(CCompiler.java:169)
        at zcc.ZCC.compile(ZCC.java:230)
        at zcc.ZCC.main(ZCC.java:127)
Makefile:113: recipe for target 'bin/example.params' failed
make: *** [bin/example.params] Error 1
maxhowald commented 5 years ago

Thanks for reporting this. Unfortunately, strings and string literals are another thing that the Pepper compiler simply doesn't have much support for. Adding this isn't a priority for us right now, but we're always happy to accept pull requests! If you (or anyone else reading this) is interested, I'm happy to provide some code pointers on how to get started.