hexagonal-sun / bic

A C interpreter and API explorer.
GNU General Public License v2.0
815 stars 36 forks source link

C-style comments not supported #10

Closed tavianator closed 5 years ago

tavianator commented 5 years ago
$ cat foo.c
/* Comment */
int main() {
    return 0;
}
$ ./src/bic foo.c
Parser Error: <stdin>:1 syntax error, unexpected '/'.
tavianator commented 5 years ago

Ah I guess it's expecting preprocessed files

hexagonal-sun commented 5 years ago

Indeed, I'm going to look at making bic automatically preprocess C files that are input so macros are expanded, comments stripped, etc.

vesche commented 5 years ago

@hexagonal-sun

In this same vein, support for define would be nice:

BIC> #define NUMBER 1337
Parser Error: syntax error, unexpected IDENTIFIER, expecting ',' or ';'.
hexagonal-sun commented 5 years ago

Ah good spot, I've raised a new issue for this as this is a REPL feature.

hexagonal-sun commented 5 years ago

This should now be fixed. C files are now pass through the preprocessor before parsing.