humberto-ortiz / compilers-2020

Example code for Spring 2020 Compilers course.
0 stars 8 forks source link

Lexer y parser #2

Open manodg opened 4 years ago

manodg commented 4 years ago

Lexer y parerser para lenguaje con funciones, quien me ayuda

--Manuel

Deneb-Algedi commented 4 years ago

Yo

-Dianelys

humberto-ortiz commented 4 years ago

The parser has trouble with trailing newlines. This works,

# parse "123";;
- : prog = Expr (Num 123L)

but this doesn't

# parse "123\n";;
Exception: Parser.MenhirBasics.Error.
alcanie1 commented 4 years ago

Pueden intentar añadir estas reglas al lexer | '\n' { EOL } | '\r' { EOL } | "\r\n" { EOL }

y quitar esta | ['\n' ] { EOL }

para ver si eso hace algo