Skip to content

Source 2 Source compiler bug #10

@bundgaard

Description

@bundgaard

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions