This code calls the mpc_parse function with our parser Lispy, and the input string input. It copies the result of the parse into r and returns 1 on success and 0 on failure. We use the address of operator & on r when we pass it to the function. This operator will be explained in more detail in later chapters.

    Otherwise there has been an error, which is copied into r in the field error. We can print it out using mpc_err_print and delete it using mpc_err_delete.

    1. Lispy Version 0.0.0.0.2
    2. Press Ctrl+c to Exit
    3. lispy> + 5 (* 2 2)
    4. >
    5. regex
    6. expr|>
    7. char:1:5 '('
    8. operator|char:1:6 '*'
    9. expr|number|regex:1:8 '2'
    10. expr|number|regex:1:10 '2'
    11. regex
    12. lispy> hello
    13. <stdin>:1:1: error: expected whitespace, '+', '-', '*' or '/' at 'h'
    14. lispy> / 1dog
    15. <stdin>:1:4: error: expected one of '0123456789', whitespace, '-', one or more of one of '0123456789', '(' or end of input at 'd'
    16. lispy>

    I’m getting an error <stdin>:1:1: error: Parser Undefined!.