Compiler/lexical analyzer: Difference between revisions

m
→‎{{header|C}}: Changed to compile warning free with pedantic, as well as Wall and extra.
m (→‎{{header|Haskell}}: made spacing uniform)
m (→‎{{header|C}}: Changed to compile warning free with pedantic, as well as Wall and extra.)
Line 950:
 
=={{header|C}}==
Tested with gcc 4.81 and later, compiles warning free with -Wpedantic -pedantic -Wall -Wextra
<lang C>#include <stdlib.h>
#include <stdio.h>
Line 991:
da_dim(text, char);
 
tok_s gettok(void);
 
static void error(int err_line, int err_col, const char *fmt, ... ) {
Line 1,004:
}
 
static int next_ch(void) { /* get next char from input */
the_ch = getc(source_fp);
++col;
Line 1,070:
static TokenType get_ident_type(const char *ident) {
static struct {
const char *s;
TokenType sym;
} kwds[] = {
Line 1,117:
}
 
tok_s gettok(void) { /* return the token type */
/* skip white space */
while (isspace(the_ch))
Line 1,148:
}
 
void run(void) { /* tokenize the given input */
tok_s tok;
do {
155

edits