qingyi-yan / POET

Other
1 stars 2 forks source link

Failure to parse hashtags in define statements and include statements #2

Closed DeveloperPOET closed 4 years ago

DeveloperPOET commented 4 years ago

This command was run on a remote machine: pcg -pinfile="code.C" -poutfile="out.c" C2C.pt

After running this command I get this error:
Done reading POET input file code.C Line 70: syntax error : # At line 5 of file C2C.pt from _

Inside the file code.C the line #70 contains this content: #define global

Below is the content of my .pt file

<define timer_counter 0/>

< You can add transformations to the inputCode here >

res = input; new_nest = NULL; foreach p = CODE.Nest#(loop=_,body=_) \in input do <* res = REPLACE(res_body, "acc_timer_begin(acc_timer, \"loop_" timer_counter "\");\n" res_body, res); *> <*REPLACE(loop, "acc_timer_begin(acc_timer, \"loop_" timer_counter "\");\n" loop, p);*> new_body = XFORM.ForPattern(body); id_str = "\"loop_" ^ timer_counter^"\""; timer_id = "acc_timer"; beg_timer_str = "acc_timer_begin(" ^timer_id^ "," ^id_str^");\n"; end_timer_str = "acc_timer_end(" ^timer_id^ "," ^id_str^");\n"; new_nest = REPLACE(loop, beg_timer_str loop, CODE.Nest#(loop, new_body)); res = REPLACE(p, new_nest end_timer_str, res); <*res = REPLACE(p, new_nest "acc_timer_end(acc_timer, \"loop_" timer_counter "\");", res);*> <*res = REPLACE(p, CODE.Nest#("acc_" timer_counter "" loop, new_body) my_str, res);*> timer_counter+=1; <*REPLACE(p, p "zoop\n", realInput);*> <*res_body = XFORM.ForPattern(body);*> enddo return res;
qingyi-yan commented 4 years ago

Please attach all the related files for reproducibility. Since you have a syntax error reported for the file you try to parse, you need to look at the input command used in your pt file and know which syntax file you use to parse the input code. Your input command is not included in the text you pasted from your pt file. Also, to debug parsing problems, you can (should) use the -dp option to enable the parsing process being output, so that you can change your syntax specification as needed.