Re:Show HN: Detecting the Programming Language of Code Using...
by scott_s on Monday July 18, 2016 @01:58PM
(#12116868)
Have you only tested syntactically valid code? For example, the code snippet:
Is clearly either C or C++, but it's not valid C or C++ because "i ? N" is not a valid boolean expression in the for loop. I actually think your techniques would work on syntactically invalid code, but I'm curious if you tried.
[ Parent
| on HN ]
Re:Show HN: Detecting the Programming Language of Code Using...
by pprogrammer on Monday July 18, 2016 @02:05PM
(#12116932)
Probably almost all of the samples are syntactically valid, but it probably works OK for invalid code. Adding or removing symbols can have an impact on the results though, as those may occur more frequently in other languages.
Re:Show HN: Detecting the Programming Language of Code Using...
by ZanyProgrammer on Monday July 18, 2016 @03:12PM
(#12117403)
Maybe not valid C code, depending on what version, because of the int in the loop?