diff options
| author | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2025-12-21 22:03:34 +0100 |
|---|---|---|
| committer | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2025-12-21 22:03:34 +0100 |
| commit | c7878cd824360c6bf8a8e987acfa6a31140e9d69 (patch) | |
| tree | b1b882d77df4a5571c38cf6aada7666890a6423b /lisp.l | |
| parent | 47debf8cc2197187a347b43a795120638b017d5f (diff) | |
add builtins, add pretty printing for lists, fix erroneous symbol x not found for forms (define, lambda ...) add check for head->type == VT_SYMBOL on forms (so a string cannot be misinterpreted as a form symbol), move is_integer from lisp.y to lisp.h/lisp.c
Diffstat (limited to 'lisp.l')
| -rw-r--r-- | lisp.l | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -7,14 +7,14 @@ int tcnt = 0; %} %% -[[:space:]]+ { printf("%d: WHITESPACE\n", tcnt); /*ignore whitespace*/} -"(" { printf("%d: LPAREN\n", ++tcnt); return LPAREN; } -")" { printf("%d: RPAREN\n", ++tcnt); return RPAREN; } -"\." { printf("%d: DOT\n", ++tcnt); return DOT; } +[[:space:]]+ { /*ignore whitespace*/} +"(" { return LPAREN; } +")" { return RPAREN; } +"\." { return DOT; } [+-]?([0-9]+|([0-9]*\.[0-9]+))([eE][-+]?[0-9]+)? { yylval.dval = atof(yytext); - printf("%d: NUMBER: %f\n", ++tcnt, yylval.dval); + return NUMBER; } @@ -27,13 +27,13 @@ int tcnt = 0; str[len] = '\0'; yylval.strval = str; - printf("%d: STRING: \"%s\"\n", ++tcnt, yylval.strval); + return STRING; } [^[:space:]\"().]+ { yylval.strval = strdup(yytext); - printf("%d: SYMBOL: %s\n", ++tcnt, yylval.strval); + return SYMBOL; } . ; // do nothing |
