Giter Club home page Giter Club logo

stitch's People

Contributors

danhcole avatar ms4985 avatar rhaydar avatar timwaterman avatar

Watchers

 avatar  avatar  avatar

stitch's Issues

block was reversing statements

A bunch of tests were failing because the cast seems to have been reversing block statements in function calls. I took out a List.rev in the semantic analyzer, which seems to have fixed the issue.

Can we add a test or two that confirms that this is an actual fix, and didn't break something I'm not thinking of?

Array Passing

Array passing for stitch loops works only for arraydecls, not for inits. Need to go back and rewrite those later on.

Shift/Reduce Errors 10/29

4 Shift/Reduce errors in stch_parser.mly:

22: shift/reduce conflict (shift 5, reduce 16) on INT
22: shift/reduce conflict (shift 6, reduce 16) on CHAR
22: shift/reduce conflict (shift 7, reduce 16) on FLOAT

  • shift on INT/CHAR/FLOAT conflicts with a bunch of tokens (reduce 16 covers 10 different tokens)

41: shift/reduce conflict (shift 54, reduce 32) on LPAREN

  • looks like a conflict between LPAREN and one or more tokens (reduce 32 covers 38 different tokens...)

It looks like both of these may (may) stem from the LPAREN token, as that is covered by both shift 54 (from state 41) and reduce 16 (from state 22). Might be a good place to start.

Default functions like print()

Print is weird. I have a skeleton set up inside the semantic analyzer for it, but we need to nail down its arguments. We have 3 options:
-Let it only take in Strings
-Let it take in any type, and have a new "polymorphic" type to compensate
-Let it keep using printf args, and try to figure out how to type check variadic functions in our own type checker (seems really hard, so lets not do this one)

Stitch loop variable passing

I can now establish a struct that will hold every variable a stitch loop could have access to, and have constructed it at the start of the program. The challenge now is going to be to change how the variables are accessed in the stitch loops to add the proper -> dereferencing before them.
Maybe a separate string_of_expr that adds that to expressions in stitch loops? It's horrifically messy but it would work.

Stitch scoping

Stitch needs to properly scope variables from the environment

Testing

General list of tests we need (feel free to edit and add):

negative

  • error with invalid data types
  • improper array decl and access
    • array with mismatched type decl
  • Stitch loops

stch_headers

Need to add file open, read, write to headers

return type of functions

Even if there is no return statement inside a function definition, you can still declare the return type of the function to be int/float. Is this something we want to allow to happen? Or do we want functions that don't have return statements inside to have return type as void by default?

Variable decls inside loops

Inside stitch(all?) loops, variable decls are messed up if you don't include { } to signify a new block. Also, stitch can't seem to have variables with the same name as variables declared outside its scope. Looking into ways to fix this.

remove code diffing from test suite

per Edwards, we should only diff w/ expected output, since ast -> cast -> pretty print may generate differently formatted but functionally identical code.

Nested Stitch

Nesting Stitch loops inside other scopes doesn't generate the stitch functions properly

Arrays and size

In C, arrays either need:
-explicit size defined at creation
-explicit initialization defined at creation

Right now our code allows int a[]; to get through. I might want stitch to require array sizes defined at creation to make things easier with the code we already have written. Just a reminder for myself.

Assignment

Assignment isn't keeping the RHS in the transition from our semantic analyzer to our C_ast.
Need to try to pass along the expression that's on the right.

Also need to add Vdecl to semantic analyzer so that you can declare and then define a variable.

check_call throwing wrong error

As is, there is no 'print' function. check_call correctly catches this, but throws the wrong error.

    and check_call (f: string) (el: expr list) (env: stch_env) =
        let l_expr_typ = List.map (fun e -> check_expr e env) el in
        let func_ret = find_func env.funcs f in
        let args_l = find_func_sig f l_expr_typ func_ret in
            C_Call(func_ret.fdecl_name, args_l), func_ret.fdecl_type

The second line of this (let func_ret ...) calls find_func, which should throw an error since print isn't a known function. However, the error that does get throws is from the next line, from find_func_sig. It seems like find_fun is finding a function (possibly with no signature), and returning it, only to have find_func_sig fail.

Not sure if this is just a strage OCaml issue, or if there is a bigger underlying mistake. Assuming this goes away when we add the default functions (Soon™), we still definatly need to set up a negative test that calls a func that was never declared.

char type

When assigning to a char, Stitch can only handle lowercase but always prints it uppercase (so the test always fails).

char z = 'Z';
Stitch thinks the capital Z is another ID, not a character for some reason.

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.