diprism / perpl

The PERPL Compiler
MIT License
10 stars 5 forks source link

Possible "extern" rule optimization #10

Closed colin-mcd closed 2 years ago

colin-mcd commented 2 years ago

For extern sample_p : Bool; we currently add the nonterminal sample_p with one edge named p, and then add the factor p with weights to be chosen at run-time. But why not just avoid the extra node and have sample_p be itself the factor, with no rule?

ccshan commented 2 years ago

Is it perhaps so that when an expression is a reference to a global variable, the expression is translated the same way whether the global variable is concretely-defined or extern-declared?

davidweichiang commented 2 years ago

Yeah, something like that.

colin-mcd commented 2 years ago

Oh, I see. Sounds good.