Computer Science Canada Syntax Quickref: Turing <--> BeanShell |
Author: | rizzix [ Sun Mar 27, 2005 5:02 pm ] | ||||||||||||||||||||||||||||||||||||||||||||
Post subject: | Syntax Quickref: Turing <--> BeanShell | ||||||||||||||||||||||||||||||||||||||||||||
Following the similar style wtd implemented, (actually ripped off, but all credit to wtd ) of intro tutorials for the Turing programmer: BeanShell (the beginning steps to Java) for the Turing Programmer Input-Output Printing to the standard output. Turing
BeanShell
As for not skipping the new line: Turing
BeanShell
Printing an integer. Turing
BeanShell
Printing a floating point number. Turing
BeanShell
Getting a line from the keyboard. Turing
BeanShell
Getting a single character from the keyboard. Turing
BeanShell
Getting an integer from the keyboard. Turing
BeanShell
Getting a float from the keyboard. Turing
BeanShell
Math
Comparisons
Conditional Statements/Expressions
Function Definition
Types of Variables in BeanShell
Comments
More to come. |
Author: | Naveg [ Sun Mar 27, 2005 7:39 pm ] |
Post subject: | |
i think these posts should include where to get the language and how to edit/use it |
Author: | Mazer [ Sun Mar 27, 2005 7:44 pm ] |
Post subject: | |
Because Google is too complicated[url=http://www.mnsi.net/~mdss/Evasive_Maneuvers.zip]?[/url] |
Author: | rizzix [ Sun Mar 27, 2005 9:23 pm ] | ||
Post subject: | |||
ok here where you get it: www.beanshell.org download the bsh-2.0b2.jar file, it includes everything. BeanShell is just a framework that comes along with an Interpreter and a Windowed Shell (called Console). to run the shell double click the jar file. to run the interperter type the following in console: java -jar bsh-2.0b2.jar XYZ [filename] [args] where XYZ is one of the following: bsh.Console // run the graphical desktop bsh.Interpreter // run as text-only on the command line bsh.Interpreter filename [ args ] // run script file to make things simpler is suggest you just drop the file in the $JAVA_HOME/lib/ext folder then to run the interpreter you just type:
now that its in the /ext folder you might ask how do i make in convenient so that when i double click it the shell pops up, or when i drag a file on it, bsh executes it? for that I created (and attached) this wrapper program that basically all it does is invokes the bsh.Interpreter class. It is necessary that you download the jar file and placed it in the folder stated above for this to work. And just a personal note: i find it convenient to keep the wrapper program on my desktop. as for creating a new BeanShell script file, first open up a simple text editor and save a file as whatever.bsh. then you may code in it as you wish. to run the file drag-n-drop it over the bsh.exe wrapper. if its a cui script i suggest you invoke java bsh.Interpreter whatever.bsh at console. enjoy PS: i know i haven't mentioned this, but BeanShell is 100% java compatible (except maybe for some J2SE 5.0 features).. but java is not 100% BeanShell compatible. This means that java code will run in beanshell, but not necessarily the other way around. You can think of BeanShell as the loosly typed java. |
Author: | Naveg [ Sun Mar 27, 2005 9:40 pm ] |
Post subject: | |
very cool, thank you for that |