writing-a-compiler-in-ruby
writing-a-compiler-in-ruby copied to clipboard
Transform "local variables" to method calls when they're not really variables...
The parser will treat "foo" by itself as a local variable because it initially doesn't know if it's a local variable or a method call. When we have identified the set of local variables, we need to transform the set of what looks like local vars but isn't in the identified set into [:callm, :self, var,[]] instead.
(Note: This also forces us to ensure the s-expression syntax is exempt from being rewritten, and to rewrite of any calls to C functions to use the s-expression syntax to still have a way of calling out... Maybe time to look at FFI instead soon)