language-recognition

Code for identifying programming language in a text file [closed]

冷暖自知 提交于 2019-11-29 11:41:20
问题 i'm supposed to write code which when given a text file (source code) as input will output which programming language is it. This is the most basic definition of the problem. More constraints follow: I must write this in C++. A wide variety of languages should be recognized - html, php, perl, ruby, C, C++, Java, C#... Amount of false positives (wrong recognition) should be low - better to output "unknown" than a wrong result. (it will be in the list of probabilities for example as unknown: