Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source 2 Source compiler bug #10

Open
bundgaard opened this issue Sep 15, 2019 · 0 comments
Open

Source 2 Source compiler bug #10

bundgaard opened this issue Sep 15, 2019 · 0 comments

Comments

@bundgaard
Copy link

Hello,

I'm currently going through your tutorial on "Lets build a simple interpreter".
I enjoy reading the tutorial, but I don't really understand why the change in Symbol and SymbolTable from chapter 11 to chapter 13, where much of what we already have defined, you want us to redefine?

Also I encountered, something I don't really understand with the VarSymbol scope property...

I fail to see where VarSymbol.scope.scope_level is defined,

This is from the https://github.com/rspivak/lsbasi/blob/master/part14/src2srccompiler.py#L171

        var_name = node.value
        var_symbol = self.current_scope.lookup(var_name)
        if var_symbol is None:
            raise Exception(
                "Error: Symbol(identifier) not found '%s'" % var_name
            )
        scope_level = str(var_symbol.scope.scope_level)
        return '<%s:%s>' % (var_name + scope_level, var_symbol.type.name)

and roaming around in your spi.py, I cannot find the link to .scope is it possible for you to help me out?

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant