Skip to content

Instantly share code, notes, and snippets.

@xbony2
Created January 7, 2015 01:44
Show Gist options
  • Save xbony2/f87791c60f969c01a697 to your computer and use it in GitHub Desktop.
Save xbony2/f87791c60f969c01a697 to your computer and use it in GitHub Desktop.
<!--
This is experimental just to see what it looks like. I'm probably not going to make a compiler :P
-->
<import type="static">java.lang.System.out</import>
<class name="HelloWorld">
<method name="main" arguments="String[] args">
<call name="out.println" args="Hello World!"/>
</method>
</class>
@bdw429s
Copy link

bdw429s commented Jan 7, 2015

This is what that code would look like in CFML (ColdFusion markup language. (note CF also supports a JavaScript-like script syntax too)

HelloWorld.cfc

<cfcomponent>
  <cffunction name="main">
    <cfargument name="args" type="string">
    <cfset createObject( "java", "java.lang.System" ).out.println( "Hello World!" ) >
  </cffunction>
</cfcomponent>

And for completeness, this would be how you call it:

helloWorld = new HelloWorld();
helloWorld.main();

Output to the console (or Servlet's "out" log file):

Hello World!

Of course, the convention of main( String args ) doesn't exist in CF, nor would I use the system out, but you get the picture :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment