orangeduck / BuildYourOwnLisp

Learn C and build your own programming language in under 1000 lines of code!
http://www.buildyourownlisp.com/
Other
2.9k stars 394 forks source link

Chapter 8 LERR_BAD_OP will not fire #104

Closed schmty closed 8 years ago

schmty commented 8 years ago

Instead it will default to using the mpc error instead, trying to figure out how I can get the custom error message to be displayed instead. Any ideas?

orangeduck commented 8 years ago

You need to add some more potential operators to the mpc grammar. For example you could switch it to: operator : '+' | '-' | '*' | '/' | '|' | '&' ; \

schmty commented 8 years ago

@orangeduck alright, I see what you mean. I was just wondering about actually overriding the mpc error default if a symbol outside of the defined grammar is used for the BAD_OP error to throw instead, but I'm sure more stuff is coming in the following chapters. Thanks for the quick reply!