Coder Social home page Coder Social logo

lsbasi's Issues

broken genastdot.py since part 18

I've tried to generate AST in part18 using genastdot.py, but it raised AttributeError: 'ProcedureDecl' object has no attribute 'params'.
This can be fixed by altering self.formal_params on self.params in ProcedureDecl class.

incorrect proccall definition

"""proccall_statement : ID LPAREN expr? (COMMA expr)* RPAREN"""

It currently reads """proccall_statement : ID LPAREN expr? (COMMA expr)* RPAREN"""
I believe the correct version is """proccall_statement : ID LPAREN (expr (COMMA expr)*)? RPAREN""", because otherwise foobar(, b, c) would be valid.

If I'm right, then the only additional change is that the while loop

while self.current_token.type == TokenType.COMMA:
needs to be indented.

part 15 missing

Given the fantastic work you've done so far, its a real shame to leave it hanging, the work with nested scopes is fantastic and brilliantly explained.

A great topic for the next instalment might be IF blocks with their own scopes

From there you only need some rudimentary input / output and you have a much more complete set of articles...

Thank you so much :)

Thank you so much for making your Let's build a simple interpreter series, it's really helping me learn how interpreters work while I'm making my own programming language in JavaScript ๐Ÿ˜„

Source 2 Source compiler bug

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.