Code Monkey home page Code Monkey logo

hw2's Introduction

ICD23 Homework2

How port your homework1 to homework2

  1. Remove the main from the scanner.l.
  2. Remove all the #define [TOKEN] [INDEX] in scanner.l (we define them in parser.y with %token).
  3. Add #include "parser.h" in your scanner.l.
  4. Add a #pragma token on and #pragma token off to control [INFO] and token(type:...)... message, default is off.
  5. Scanner should not handle negative numbers, please remove all [+-] at the begining of integer, scientific, float rules in scanner.l. And plese add rule of factor ::= sub factorin parser to handle negative numbers.

Please follow the grammar in 01-minipascal-spec.pdf to write your syntax rule in parser.y.

Note: You don't need to create a grammar yourself, just use the grammar in 01-minipascal-spec.pdf .

Some useful online information

bison

lex(flex)

Makefile

C preprocessor(cpp)

standard pascal.y

Grading

Please run make debug to see how many testcases you could pass.
You will get the exact grade if you define your behavior properly in scanner/parser
(e.g. no hard-coded, no edit the testcase ... )

Hand-in homework

Please run make pack and upload the compressed file to E3.

Visualize your parser

Please use make debug in the docker, and it will create a png file.

hw2's People

Contributors

hellcwang avatar nobodyzxc avatar stevedreyex avatar rniczh 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.