I am attempting to change one keyword in OCaml - I want to just change the string literal the keyword is, not the token. So, in the lexer and parser, I retained the token, but changed the string literal associated with it. Initially, when I tried to ./configure make, it gave me an error because the keyword was used somewhere in OCaml files - neither the new nor the old keyword seemed to work there, both gave a syntax error. Then, since OCaml was bootstrapped, I tried to make a version of it that accepted both the keywords, then I tried to use this initial build to compile further iterations, but that too did not work. I think I’m getting something wrong in the bootstrapped architecture of the OCaml build.
In short:
Token t → String s
now Token t → String s’
Neither s nor s’ accepted in OCaml files (I am getting a syntax error in the first instance of s/s’ in stdlib)
@kayceesrk Thank you for referring me here
Can you post the exact error messages that you are getting in the output.
So the error is slightly a different one now because I was able to get it to accept my new keyword ‘where’ in many of the files, but when it reached parser.mly - it would neither accept the old keyword ‘when’, nor the new keyword ‘where’. In other files (let’s say in utits/ and stdlib/, it has accepted the new keyword ‘where’).
EDIT: I have removed the conflicting instance of ‘when’ and used if-else instead. It has successfully been able to compile itself with the keyword ‘where’ in place of ‘when’ in all its files
That’s great! Are you also able to compile a regular program that uses your new keyword, outside of the compiler code itself?