Star Script

Simplify Web Application Development

Introducing Star Script (2): Hello World

What does Star Script look like? Let’s start with some simple examples. The first program that people learn in most programming language is the “Hello World” program. The requirement is quite simple: please output the text “Hello World” using this language. You can check out the list of “Hello World” programs at many websites such as this.

Now, how to write the “Hello World” program in Star Script? It is the simplest you can ever imagine. Just enter the text “Hello World!”. The Star Script compiler will compile it, execute it, and output “Hello World!”, exactly as what you entered. Surprisingly simple. This behavior is quite unusual for a programming langauge. Yet it is exactly how most templating language behaves. For any template, if there is no special patterns recognized, output will equal input. At this point, I would like to make a bold statement: anybody, without any learning, can write program in Star Script. It is a statement which I don’t think any other programming language* can make. Yet, this is a feature that is extremely important to the target users of Star Script – casual programmers. As a casual programmer,  you want to get started instantly, without any learning. As you grow to be more experienced, of course, you will need to learn programming language concepts and features. But for Star Script users, you can learn it lazily, only learn a feature when you actually need it. You don’t have to learn many concepts such as class, method, arguments, static, void, main, array, string literal, etc, in order to write the first “Hello World” program. In fact, as a Star Script user, you need to learn nothing to get started.

Now, you see the templating side of the Star Script. How about the programming language side of it? If I enter an expression, will it get evaluated? Of course. If you enter 1+1, you will get 2 as the output. What if I want to display the text 1+1, and do not want it to be evaluated? Star Script also supports string literal, which is basically some text enclosed in the double quote (“). If you enter the program “1+1”, you will get the text 1+1 as output instead of 2.

How about other common programming constructs? Star Script is a fully featured, object-oriented programming language, so it supports all major programming constructs. Just as a simple example, if you want to say hello to some specific people instead the entire world, you can use the below program:

var world = "my dear friend"
Hello World!

You probably can guess it’s output. It is

Hello my dear friend!

To conclude this post, let’s have a little quiz. How to write a program that print out itself in C? Now, how to write a program that print out itself in Star Script?

*  I only consider a langauge as programming langauge when it is Turing Complete. Thus, I don’t consider HTML as a programming langauge.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: