zsaleeba / picoc

A very small C interpreter
1.45k stars 183 forks source link

Fetching Variables #33

Open YAziani opened 7 years ago

YAziani commented 7 years ago

Excuse the amateurish question, but how could I fetch the value of variables I have declared within the source code of the ParseState-parameter of "ParseStatement"?

For example, if I run "ParseStatement" using my ParseState I have prepared with int x = 5; as a parameter of "LexInitParser", how could I get my hands on the value of x within the scope where I run ParseStatement?

I have tried iterating through pc->GlobalHashTable and pc->StringHashTable and searched my variable by checking entry->p.v.Key and entry->p.v.Val but couldn't find it.

Many thanks in advance.