zl90 / Cornell-CS4120

I'm taking Cornell University's "Introduction to Compilers" course
5 stars 0 forks source link

Look into handling string literals containing newlines #14

Closed zl90 closed 1 year ago

zl90 commented 1 year ago

Check the assignment spec and the Eta language spec for this.

The problem is, if newlines are allowed inside string literals, then parsing the .lexed file will be difficult without some special way of representing string literals.

Possible answers:

  1. Prevent string literals from having newlines.
  2. Store the quotation marks in the value of the string literal token (possibly violates the assignment spec).
zl90 commented 1 year ago

Found the answer. From the Eta language spec:

String literals may not span multiple lines in the source file.

So need to prevent strings from containing newlines.