Giter Club home page Giter Club logo

jit's People

Contributors

kcecireyes avatar prashant-jayan21 avatar raulmatias avatar rischimart avatar rkuykendall avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jit's Issues

Generate python instead of evaluating AST.

"Make the language more a translator than an interpreter: python generation over python evaluation"

"Important: import the necessary libraries and print them out to the file beforehand."

Begin testing framework

Two considerations:

  1. Are we generating the right python?
  2. Are we outputting the desired output?

Add scope checking to AST.

Create an AST to do type checking and semantic checking [before translation to python].

Type checking and scope checking: traverse the tree and add information as you go: a table (dictionary, matrix data structure) of the variables that are in scope and types. For any given line, check whether vars are in scope and types for operations (int + int, etc)

Symbol table:
When you get to a var declaration, add the function or whatever is in scope to the table, pass it down to the next node. When it goes out of scope, stop the branch.

Add type checking to AST.

Create an AST to do type checking and semantic checking [before translation to python].

Type checking and scope checking: traverse the tree and add information as you go: a table (dictionary, matrix data structure) of the variables that are in scope and types. For any given line, check whether vars are in scope and types for operations (int + int, etc)

Symbol table:
When you get to a var declaration, add the function or whatever is in scope to the table, pass it down to the next node. When it goes out of scope, stop the branch.

Add database support.

"The database is not a key part of the project but it's necessary to have it to test the language, so get this working fast and soon. Graph algorithms should also work for testing soon."

Add 'type' field to AST nodes to be accessible to Symbol Table for sem checks

this is so I will be able to do this, for production ID EQUALS expression:

   elif len(p) == 4:
        # ID EQUALS expression
        if isinstance(p[3], str):
            p[3] = AstString(p[3])
        p[0] = AstBinOp(AstID(p[1]), p[2], p[3])

        # Semantic Checking: 
        var_name = p[1]
        var_type = p[3].type # need dis
        var_record = {'name': var_name, 'type': var_type }
        j = Parser.ST.searchRecord(var_name)
        if j == -1:
            print "Semantic error: Initialization without declaration"
        else:
            if (Parser.ST.getRecordType(j) is var_type):
                self.ST.updateRecord(j,var_record) # same type updating, good
            else:
                print "Semantic error: Type mismatch in redeclared variable " + var_name

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.