got my VM transpiling IR to C. neat! :D

#PLDev

@eniko $ is legal in C identifiers? huh, had no idea

@gibbed @eniko it's a common extension; GCC and Clang allow it by default, but if you use the `-pedantic` option, they issue a warning, and if you use `-pedantic-errors`, they issue an error and refuse to generate machine code.

...or at least, that's how it used to be, before the ISO standards added unicode support:
http://eel.is/c++draft/lex#nt:identifier-start

(that's C++, but the current C draft has an equivalent definition for the grammar term "identifier")

[lex]

@gibbed @eniko
So the ISO standards now refer to the unicode rules for identifiers, but for the special case of "$", it looks like unicode leaves the choice up to the language:
https://www.unicode.org/reports/tr31/tr31-41.html#Table_Optional_Start

so... it seems like the ISO C/C++ standards haven't really been clear on this point?

But for practical purposes, we can see that clang & GCC treat it as a non-standard extension.

UAX #31: Unicode Identifiers and Syntax

@gibbed @eniko
(fwiw, in my personal/experimental code, i always enable support for GCC extensions in Clang, 'cause they're just too handy, and so far i've found that the goal of maximum portability is usually incompatible with programming-for-fun)

@gibbed @eniko oops; i take it back: the ISO C/C++ standards are actually unambiguous: they refer to the character properties XID_Start and XID_Continue, and the characters with those properties are listed here:

https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt

... and U+0024 DOLLAR SIGN has neither of those properties, so ISO C/C++ says '$' is not an identifier character.

(but, again, nonstandard extensions are fun.)