Noopã§Hello World!
ä»åã¯ãã¼ã¿ãã¼ã¹ã®ãã¿ããä¼ã¿ãã¦ãåã®ããã°ã©ãã³ã°è¨èªNoopã試ãã¦ã¿ã¾ããã
- éå ±ï¼ã°ã¼ã°ã«ãæ°è¨èªãNoopããå ¬éãJavaVMã§åä½ â Blog on Publickey
- JVMã§åä½ããæ°è¨èªãNoopã- Googleéçºè ãã«ããæ°ããã¸ã§ã¯ã | ã¨ã³ã¿ã¼ãã©ã¤ãº | ãã¤ã³ãã¸ã£ã¼ãã«
以ä¸ãNoopã§Hello World!ãåããã¾ã§ã®æé ã§ãã
JDKã®ã¤ã³ã¹ãã¼ã«
Noopã¯Java VMä¸ã§åä½ããã®ã§ãã¾ãJava SE Development Kit(JDK)ãã¤ã³ã¹ãã¼ã«ãã¾ãã
ã¤ã³ã¹ãã¼ã«ãæ¸ãã ããC:\Program Files\Java\jdk1.6.0_16\binã«ãã¹ãéãã¦ããã¾ãã
TortoiseHgã®ã¤ã³ã¹ãã¼ã«
Noopã¯Mercurialã§ãã¼ã¸ã§ã³ç®¡çããã¦ããã®ã§ãWindowsç¨ã®ã¯ã©ã¤ã¢ã³ãã¨ãã¦TortoiseHgãã¤ã³ã¹ãã¼ã«ãã¾ãã
Noopã½ã¼ã¹ããªã¼ã®åå¾
ã³ãã³ãããã³ãããããhgã³ãã³ããç¨ãã¦Noopã®ã½ã¼ã¹ããªã¼ãåå¾ãã¾ãã
C:\>hg clone https://noop.googlecode.com/hg/ noop requesting all changes adding changesets adding manifests adding file changes added 71 changesets with 336 changes to 78 files updating working directory 64 files updated, 0 files merged, 0 files removed, 0 files unresolved
ãããªæ§æã«ãªãã¾ããããªãã·ã³ãã«ã§ããã
Rubyã®ã¤ã³ã¹ãã¼ã«
Noopã¯Apache Buildrã§ãã«ãããã®ã§ãããApache Buildrã¯Rubyã§ä½ããã¦ããã®ã§å
ã«Rubyãã¤ã³ã¹ãã¼ã«ãã¾ããWindowsçã®Rubyã¯ããã¤ãããã¾ãããä»åã¯ActiveScriptRubyã使ç¨ãã¾ããã
ã¤ã³ã¹ãã¼ã«ãæ¸ãã ããC:\Program Files\ruby-1.8\binã«ãã¹ãéãã¦ããã¾ãã
Apache Buildrã®ã¤ã³ã¹ãã¼ã«
Rubyã®gemã³ãã³ãã§Apache Builderãã¤ã³ã¹ãã¼ã«ãã¾ãã
C:\>gem install buildr ************************************************** Thank you for installing rspec-1.2.2 Please be sure to read History.rdoc and Upgrade.rdoc for useful information about this release. ************************************************** To get started run buildr --help Successfully installed rake-0.8.4 Successfully installed builder-2.1.2 Successfully installed net-ssh-2.0.11 Successfully installed net-sftp-2.0.2 Successfully installed rubyzip-0.9.1 Successfully installed highline-1.5.0 Successfully installed rubyforge-1.0.3 Successfully installed hoe-1.11.0 Successfully installed rjb-1.1.6-x86-mswin32-60 Successfully installed Antwrap-0.7.0 Successfully installed rspec-1.2.2 Successfully installed xml-simple-1.0.12 Successfully installed archive-tar-minitar-0.5.2 Successfully installed buildr-1.3.4 14 gems installed Installing ri documentation for rake-0.8.4... Installing ri documentation for builder-2.1.2... ERROR: While generating documentation for builder-2.1.2 ... MESSAGE: Unhandled special: Special: type=17, text="<!-- HI -->" ... RDOC args: --ri --op C:/Program Files/ruby-1.8/lib/ruby/gems/1.8/doc/builder -2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers --qu iet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/bui lder-2.0.0.rdoc doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentat ion (continuing with the rest of the installation) Installing ri documentation for net-ssh-2.0.11... Installing ri documentation for net-sftp-2.0.2... Installing ri documentation for rubyzip-0.9.1... Installing ri documentation for highline-1.5.0... Installing ri documentation for rubyforge-1.0.3... Installing ri documentation for hoe-1.11.0... Installing ri documentation for rjb-1.1.6-x86-mswin32-60... Installing ri documentation for Antwrap-0.7.0... Installing ri documentation for rspec-1.2.2... Installing ri documentation for xml-simple-1.0.12... Installing ri documentation for archive-tar-minitar-0.5.2... Installing ri documentation for buildr-1.3.4... Installing RDoc documentation for rake-0.8.4... Installing RDoc documentation for builder-2.1.2... Installing RDoc documentation for net-ssh-2.0.11... Installing RDoc documentation for net-sftp-2.0.2... Installing RDoc documentation for rubyzip-0.9.1... Installing RDoc documentation for highline-1.5.0... Installing RDoc documentation for rubyforge-1.0.3... Installing RDoc documentation for hoe-1.11.0... Installing RDoc documentation for rjb-1.1.6-x86-mswin32-60... Installing RDoc documentation for Antwrap-0.7.0... Installing RDoc documentation for rspec-1.2.2... Could not find main page README.rdoc Could not find main page README.rdoc Could not find main page README.rdoc Could not find main page README.rdoc Installing RDoc documentation for xml-simple-1.0.12... Installing RDoc documentation for archive-tar-minitar-0.5.2... Installing RDoc documentation for buildr-1.3.4...
Scalaã®ã¤ã³ã¹ãã¼ã«
Noopã¯Scalaã§ä½ããã¦ããã®ã§ãScalaãã¤ã³ã¹ãã¼ã«ãã¾ããWindowsçScalaã®ã¤ã³ã¹ãã¼ã«ã¯ããã¦ã³ãã¼ãããZIPãã¡ã¤ã«ãå±éããã ãã§ãã
ã¤ã³ã¹ãã¼ã«ãæ¸ãã ãã<ã¤ã³ã¹ãã¼ã«å
ãã©ã«ã>\binã«ãã¹ãéãã¦ããã¾ãã
Noopã®ãã«ã
ç°å¢å¤æ°JAVA_HOMEã¨SCALA_HOMEãè¨å®ããApache Builderãç¨ãã¦Noopããã«ããã¾ãããã ããæä¾ããã¦ããbuildr.batãã¡ã¤ã«ã使ç¨ããã¨ãä»åã®æ§æã§ã¯ä»¥ä¸ã®ãããªã¨ã©ã¼ãåºã¦ãã¾ãããã§ãã
C:\noop>set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_16 C:\noop>set SCALA_HOME=C:\Scala276 C:\noop>buildr C:/Program Files/ruby-1.8/bin/buildr:19:in `load': no such file to load -- "C:/P rogram Files/ruby-1.8/lib/ruby/gems/1.8/gems/buildr-1.3.4/bin/buildr" (LoadError) from C:/Program Files/ruby-1.8/bin/buildr:19
ãã®ãããrubyã³ãã³ãã§ç´æ¥buildrã¹ã¯ãªãããèµ·åãã¾ãã
C:\noop>ruby "C:\Program Files\ruby-1.8\lib\ruby\gems\1.8\gems\buildr-1.3.4\bin\buildr" (in C:/noop, development) Downloading org.apache.ant:ant:jar:1.7.1 Downloading http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/ant/ant/1.7 .1/ant-1.7.1.jar ant-1.7.1.jar: 100% |...........................| 1.3MB/1.3MB Time: 00:00:24 Downloading org.apache.ant:ant:pom:1.7.1 Downloading http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/ant/ant/1.7 .1/ant-1.7.1.pom ant-1.7.1.pom: 100% |...........................| 9.5KB/9.5KB Time: 00:00:00 (ç¥) Running tests in noop ScalaTest "noop.grammar.BlockSpec" - should allow a return statement - should allow chained property access on properties - should allow calling a method (ç¥) ScalaTest "noop.grammar.IfSpec" - should parse correctly equality expression on two literals *** FAILED *** (IfSpec.scala:16) org.scalatest.TestFailedException: "(IF 1 == 1)" was not equal to "(IF (EQ 1 1))" (ç¥) ScalaTest "noop.types.StringSpec" - should have a valid class definition parsed from Noop source - should have a native implementation of the length method Run completed. Total number of tests run was: 2 All tests passed. Completed in 1m52.234s
ç¾æç¹ã§ã¯ãããã¤ã失æãããã¹ããããããã§ãã
ãµã³ãã«ããã°ã©ã ã®å®è¡
ãã«ãçµæã¯targetãã©ã«ãã«åºåããã¾ãã
å®ã¯HelloWorldã®ãµã³ãã«ã¯æåããä»å±ãã¦ãã¾ããæ©éãããåããã¦ã¿ã¾ãããã
import noop.Application; import noop.Console; class HelloWorld(Console console) implements Application { Int main(List args) { String s = "Hello World!"; console.println(s); return 0; } }
Noopã®å®è¡ç°å¢ã¯ãç¾å¨ã®ã¨ããã¤ã³ã¿ããªã¿ã®ã¿ãæä¾ããã¦ããããã§ããã¤ã³ã¿ããªã¿ãåããã«ã¯classesãã©ã«ãã¨antlr-runtime-3.1.1.jarã«ã¯ã©ã¹ãã¹ãéããnoop.interpreter.InterpreterMainã¯ã©ã¹ãæå®ãã¦Scalaãèµ·åãã¾ãã
antlr-runtime-3.1.1.jarã¯Noopã®ãã«ãä¸ã«C:\Documents and Settings\<ã¦ã¼ã¶å>\.m2\repository\org\antlr\antlr-runtime\3.1.1ã«ãã¦ã³ãã¼ãããã¦ããã®ã§ããããã³ãã¼ãã¦ä½¿ãã°OKã§ããããããHelloWorldããã°ã©ã ã¯noop.Applicationã¯ã©ã¹ã¨noop.Consoleã¯ã©ã¹ãå©ç¨ãã¦ããã®ã§ããããããã®ã¯ã©ã¹å®ç¾©ã¯resources\stdlibãã©ã«ãã«æ ¼ç´ããã¦ãã¾ãããã®ããèµ·åãªãã·ã§ã³ã¨ãã¦ããã®ãã©ã«ããæå®ããå¿
è¦ãããã¾ãã
C:\noop\target>scala noop.interpreter.InterpreterMain Usage: InterpreterMain main-class paths/to/sources ... C:\noop\target>scala noop.interpreter.InterpreterMain HelloWorld resources\helloworld resources\stdlib Hello World!
åãã¾ããï¼
ææ³
ããã°ã©ãã³ã°ã¯å°éå¤ãªã®ã§ä½ããããã®ããã¾ãåãã£ã¦ãã¾ããããæè¿ã®éçºææ³ã£ã¦ãããããã£ã¦æ¥½ãããã§ãããã¯ã¯ã¯ã¯ãã¾ãã