(Somewhat adapted) code and solutions from the book "Build Your Own Lisp" http://www.buildyourownlisp.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
597 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <editline/readline.h>
  4. int main(int argc, char const *argv[])
  5. {
  6. /* Print version and exit information */
  7. puts("Lispy version 0.0.0.0.1");
  8. puts("Press Ctrl+c to exit\n");
  9. /* In a never ending loop */
  10. while (1) {
  11. /* Output our prompt and get input */
  12. char* input = readline("lispy> ");
  13. /* Add input to history */
  14. add_history(input);
  15. /* Echo input back to user */
  16. printf("No you're a %s\n", input);
  17. /* Free retrieved input */
  18. free(input);
  19. }
  20. return 0;
  21. }