TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What's this programming language?

24 pointsby nithinbekalalmost 13 years ago

23 comments

pavankyalmost 13 years ago
It can't understand C. <a href="http://i.imgur.com/7hrPE.png" rel="nofollow">http://i.imgur.com/7hrPE.png</a>
评论 #4057354 未加载
Someonealmost 13 years ago
Nice idea, but the quality and/or the breadth of languages it knows about leaves much to be desired.<p>The first language I tried was Forth. I have yet to find a piece of code that it recognizes as such. For example the example from <a href="http://c2.com/cgi/wiki?ExampleForthCode" rel="nofollow">http://c2.com/cgi/wiki?ExampleForthCode</a> gets a 'VHDL, could also be VBSCRIPT'<p>My next attempt was PostScript. I copied <a href="http://www.science.uva.nl/~robbert/ps/bluebook/program_01.html" rel="nofollow">http://www.science.uva.nl/~robbert/ps/bluebook/program_01.ht...</a> (which starts with the giveaway line "%!PS-Adobe-2.0"), and it says 'RUBY, could also be MEL'<p>I guess that the thing would look better of with some kind of thresholding that allows it to say 'I don't know, but if I had to guess, I would say RUBY or MEL' instead.
Akramalmost 13 years ago
&#60;script&#62; var str="hello world"; &#60;/script&#62;<p>This looks like xml. It could also be django, though. I'm not completely sure. //--------------------- How come Django is a programming language?
评论 #4057549 未加载
jhunialmost 13 years ago
(defn factorial [n] (apply * (range 2 (inc n)))) - Rust or CSS<p>(defun factorial (n) (apply (function *) (upto n))) - MATLAB or Lua
darkestkhanalmost 13 years ago
I put this:<p><pre><code> with Ada.Text_IO; procedure WTF is type X is array (Positive range &#60;&#62;) of Integer; procedure Print (N: X) is begin for I in N loop Ada.Text_IO.Put_Line (File =&#62; Ada.Text_IO.Standard_Output, Item =&#62; Integer'Image (N (I)); end loop; end Print; begin null; end WTF; </code></pre> And it can't recognize Ada :) Even when you use standard library. "This looks like VHDL." "It could also be a VBSCRIPT, though I'm not completely sure"
carbocationalmost 13 years ago
Impressive that it doesn't just take the best guess; it also informs you of its alternative hypotheses:<p><a href="http://i.imgur.com/wITwa.png" rel="nofollow">http://i.imgur.com/wITwa.png</a><p><i>Update:</i><p>Reading your blog post, I see that this is a wrapper around highlight.js, which is doing the language-guessing (including the second-best guess): <a href="http://softwaremaniacs.org/wiki/doku.php/highlight.js:api" rel="nofollow">http://softwaremaniacs.org/wiki/doku.php/highlight.js:api</a>
评论 #4057312 未加载
评论 #4057708 未加载
ittanalmost 13 years ago
Just tried it out with brainfuck(<a href="http://en.wikipedia.org/wiki/Brainfuck" rel="nofollow">http://en.wikipedia.org/wiki/Brainfuck</a>)!<p>++++++++++[&#62;+++++++&#62;++++++++++&#62;+++&#62;+&#60;&#60;&#60;&#60;-]&#62;++.&#62;+.+++++++..+++.&#62;++.&#60;&#60;+++++++++++++++.&#62;.+++.------.--------.&#62;+.&#62;.<p>XML or django. then again this could be anything. :P
评论 #4057509 未加载
pudalmost 13 years ago
Cool thing. Though it doesn't get ColdFusion. Anything with &#60;cf_____&#62; tags is ColdFusion.<p>&#60;cfset foo = "bar"&#62;
chuckbotalmost 13 years ago
<p><pre><code> int main(int argv, char **argv) { return 0; } </code></pre> Doesn't look like CS and can't even be java. Adding a printf changes the top suggestion to perl. Adding an include changes the top suggestion to vala.<p>The idea to reduce language recognition to syntax highlighting is a nice idea, but doesn't seem to work.
jvc26almost 13 years ago
Its a neat idea but seems to struggle - misidentifying PHP as BASH, and struggling with Haskell, Go, Clojure, and told me Bash was PERL. I pulled some test code from the What's That Programming Language site which appeared on HN a few weeks ago <a href="http://wtpl.heroku.com/" rel="nofollow">http://wtpl.heroku.com/</a>.
Ivataralmost 13 years ago
Doesn't seem to be familiar with factor:<p><pre><code> : foo ( seq -- nseq ) [ 1 + ] map ; </code></pre> "This looks like ruby. It could also be lua, though. I'm not completely sure."<p>I would have expected a guess at forth, but I really don't think it looks like ruby...
mseepgoodalmost 13 years ago
Input (Go):<p>-----------------------<p>package main<p>import "fmt"<p>func main() { fmt.Println("Hello, 世界") }<p>-----------------------<p>Response: "This looks like actionscript. It could also be haskell, though. I'm not completely sure."<p>FAIL
sinkalmost 13 years ago
Might mention that it sees Scala as Ruby or Python (ouch!). But I did just type in, "bunch of stuff, some programming stuff" and it thought that was Haskell or Coffeescript. Guess those win awards for literate programming?
bad_allocalmost 13 years ago
life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}<p>(APL Code for Conway's Game of Life, taken from Wikipedia) Recognized as Haskell.<p>This X[⍋X+.≠' ';] is AVRASM or CSS.<p>UPDATE: It gets better: INTERCAL (the despotic programming language) is recognized as Delphi or SQL. This seems suitable for Delphi ;) (Here's the code: <a href="http://cxg.de/_01a19b.htm" rel="nofollow">http://cxg.de/_01a19b.htm</a>)
sbmasseyalmost 13 years ago
Its not too good at C++.<p>Apparantly,<p><pre><code> template &#60;typename T&#62; T foo(T t) { return t; } </code></pre> looks like DJANGO or XML.
estenhalmost 13 years ago
So, uh... what does this say about PHP?<p><a href="http://i.imgur.com/81uas.jpg" rel="nofollow">http://i.imgur.com/81uas.jpg</a>
tluyben2almost 13 years ago
This definitely needs some work :) <a href="http://o7.no/JGT5pv" rel="nofollow">http://o7.no/JGT5pv</a>
tg3almost 13 years ago
it thought my javascript was Lua, my php was bash or ruby, and my ruby was haskell.
damian2000almost 13 years ago
Nice job... got my C# and Ruby correct, but FORTRAN was seen as VBSCRIPT.
mitchialmost 13 years ago
So bad!<p>#include &#60;stdio.h&#62; XML<p>printf("%d", i); ERLANG
hornetblackalmost 13 years ago
I put in brainfuck it said it might be VB
KonradKlausealmost 13 years ago
main() { }<p>"This looks like css. It could also be haskell, though. I'm not completely sure."<p>Erm, okay...
stewie2almost 13 years ago
not accurate at all.