GithubHelp home page GithubHelp logo

cosc4785_program3's Introduction

COSC4785_Program3

Valid input: Currently the only standalone input that my program will accept is an expression or a variable declaration. All other parts of the grammar must be a smaller part of one of those.

A note: I did implement arglist before instructed not to and i chose to take it out. However, since it can be empty, it should create no problems with your testing.

Changes in the Grammar: The biggest change I made was in how a variable is declared. First off, I made a production called multibracks. it is used in the var declaration rules. When we have the full grammar, I plan to change it to be more consistent with the actual grammar.

How I print things out: Everything should be printing as described in the instructions except for some expressions. For example given 2+2. my program will print out --> --> 2 --> + --> 2

I did this because sum op could be a number of things and so I made it a node in my tree. Mine does not print: --> + --> 2 --> 2

Error handling: I added some basic error handling rules. Many of them are something along the lines, missing a right parenthesis or missing a semicolon. However, some account for errors in the middle of a production. For example, simpletype error SEMI this allows for some more detailed error messaged. I hope to expand these once we have the full grammar.

The biggest decision I made when choosing how to handle errors, is I chose, if given enough information to construct a node, I construct it, in it's entirety. However, I mark it as an error node and I mark all of its children as error nodes. This made continuing parsing a bit easier. And having more information about what the original input looked like seemed like a good idea to me. However, I currently do not print "dirty" error node trees, nor do I even add them to the final parse tree. However, this can be changed for needs in the future. ALso the memory of a bad node tree is freed before it is lost.

cosc4785_program3's People

Contributors

wkemery avatar

Watchers

James Cloos avatar

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.