Giter VIP home page Giter VIP logo

compiler's People

Contributors

czaer avatar ilovepi avatar

Watchers

 avatar  avatar

compiler's Issues

Coverity scan reports a resource leak in Main

Coverity scan reports a defect in Main of Program Project.

Can fix with a using statement

** CID 1397995: Resource leaks (RESOURCE_LEAK)
/Program/Program.cs: 22 in System.Void Program.Program::Main(System.String[])()
16
17 } while (t != Token.EOF);
18
19 // necessary when testing on windows with visual studio
20 //Console.WriteLine("Press 'enter' to exit ....");
21 //Console.ReadLine();

CID 1397995:  Resource leaks  (RESOURCE_LEAK)
Variable "l" going out of scope leaks the resource it refers to.

22 }
23 }

Refactor Array Support

While our scheme for handling arrays will work... it is less than ideal, and wastes space. There is also a high cost for memory indirection that we pay for in this scenario.

Change to a flat array structure and then allocate the corresponding arrays based on a single offset from the base address.

Dead Code Elimination

After CSE use the use-def-chain to eliminate dead code.

Can be done in a single linear pass in which the the use list of an instruction can be queried, and removed if it has no reference

Clean up Constant Expressions after Copy Propagation

After results have propagated to their destination, there must be some clean up to remove constant expressions, and perhaps even trim constant comparisons. It will be safe to do at this point because there are no unseen instructions or blocks, and Phis can simply be removed.

Remove Store instructions

I'm not sure what to do with these, but we shouldn't generate them when we do, except for things like arrays

Support Exceptions instead of generic errors

The current parser and lexer on the rewrite branch use a simple error function similar to what Michael presented in his original lecture. There is a case to be made for this design, but a custom exception might be a better choice for maintenance and usability.

Exceptions should provide better error messages about where in the file the error occurs, and what was expected, and what was found.

this will give users a good idea about why compilation fails.

Since we're the users of this compiler, good error messages means we're not savages.
We can use some of the code from existing branches as a starting point, although they rely on an AST for the most part.

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.