(Somewhat adapted) code and solutions from the book "Build Your Own Lisp" http://www.buildyourownlisp.com
lisp
c

prompt.c 570B

123456789101112131415161718192021222324252627
  1. #include <stdio.h>
  2. /* Declare a buffer for user input of size 2048 */
  3. static char input[2048];
  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 */
  12. fputs("lispy> ", stdout);
  13. /* Read a line of user input of max size 2014 */
  14. fgets(input, 2048, stdin);
  15. /* Echo input back to user */
  16. printf("No you're a %s", input);
  17. }
  18. return 0;
  19. }