Skip to content

Commit

Permalink
Add interpreter in rust link
Browse files Browse the repository at this point in the history
  • Loading branch information
selavy committed Dec 15, 2016
1 parent 4d1e224 commit a1a8bb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# write-an-interpreter-in-c
porting "Writing An Interpreter In Go" to C https://interpreterbook.com/
following https://github.com/chr4/writing_an_interpreter_in_rust
8 changes: 2 additions & 6 deletions lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

const char *token_to_string(enum TokenType token) {
switch (token) {
Expand Down Expand Up @@ -111,12 +112,7 @@ int lexer_next_token(struct Lexer *lex, struct Token *token) {
case '}': token->type = RightBrace; break;
case '(': token->type = LeftParenthesis; break;
case ')': token->type = RightParenthesis; break;
default:
// case '=' or '=='
// case '!' or '!='
// is_letter
// is_numeric
return 1;
default: assert(0); return 1;
}
}

Expand Down

0 comments on commit a1a8bb1

Please sign in to comment.