Skip to content

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages