Advertisement

JankoScript: a language in the making

Started by August 03, 2004 03:08 PM
9 comments, last by 5MinuteGaming 20 years, 3 months ago
I have been developing (read: designing ^_^) the kernel-layer of my engine for a month or two now. I have designed a signal slot system, and remote signals too! Memory management, timers, window code. Just about anything that isn't graphics or game related. Now I'm going to design the glue to my engine. I call it Janko. It doesn't mean anything, so don't ask. I wanted a language that is simple. Meaning I don't need to write code like Java to get hello world:


class Main
{
  public static int main (blarhg)
  {
     System.out.println ("Hello World");
  }
}


I want it to be linearly executed when I want it to: ie: Engine.Console.print ("Hello World!"); The engine will include functions and objects, but they are going to be one in the same. Objects can be executed like functions, functions can have inner methods and attributes like objects (why i'm comparing them i don't know, since they are the same here) I think that would greatly simply the language a bit. Here is a final example: SomeOtherJankoObject.janko

import System;  //some static class exported by the app in which      
                //janko is embedded

object SomeOtherJankoObject
{
   object PrintText (string text)
   {
       System.print (text); 
   }
}


main.janko


import SomeOtherJankoObject

SomeOtherJankoObject obj;
obj.PrintText("Hi Beyotch!");


Note the object keyword. I don't believe it correctly defines what those particular entities are. Anyone have any good suggestions? also, the language is c-like in syntax. It has C if, while, for statements along with all the other standard statements. I'm not sure if I want to go with dynamic or static typing. So give poor old Grizwald some suggestions, before I cut out your throat. Implementation of the language won't be a problem, as I've made multiple interpreters for C-style languages.
I love me and you love you.
instead of re-inventing the wheel, why not save time for yourself and your engine modders and use a widely known languge such as Lua/JScript/UnrealScript/QuakeC

1) you save time by not having to write a compiler, just use a industry hardened library tried tested and packaged.

2) your modders save time because they dont need to learn yet another scripting language.

3) all in all its just WAY more practical, you could literaly save months of work (bug fixes and stuff) and concentrate on producing a more quality game.
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
Advertisement
I really don't care about time. I want the experience of it. And this language is different than most out there. It is a simple concept, so non-programmars will have an easy time with it. LUA or PYTHON with functions/classes and whatnot will look so cryptic to an average non-coder, who can't even comprehend a batch file.
I love me and you love you.
Are you really going to tell me that this:

class Main{  public static int main (blarhg)  {     System.out.println ("Hello World");  }}


Makes more sense to a non programmer than:
print "Hello World"

Or
function main()  print "Hello World"end

Or
Main ={  main = function ()    print "Hello World"  end}


All of which do fundamentally the same as your example.
Have you actually used Lua?
Just so you know, everything programming related looks cryptic to a non-programmer.

As long as the language makes sense (read: is logical), the user will be able to use it.
Well, I'd say that print "Hello World" is understandable to anyone who knows English, whereas System.out.println is pretty cryptic.

However, I'm really wondering why you're making no distinction between functions and objects. I think this makes the language more confusing, and is also wrong at a conceptual level. A function is a representation of an algorithm. An object is data, with perhaps some functions that operate on that data. It doesn't make sense for a function to have "fields" or "properties" like an object does. Nor does it make sense for an object to be "executed", or to take "arguments" (well, unless it's an object representing a function).
Advertisement
Quote: Original post by Matei
Well, I'd say that print "Hello World" is understandable to anyone who knows English, whereas System.out.println is pretty cryptic.

However, I'm really wondering why you're making no distinction between functions and objects. I think this makes the language more confusing, and is also wrong at a conceptual level. A function is a representation of an algorithm. An object is data, with perhaps some functions that operate on that data. It doesn't make sense for a function to have "fields" or "properties" like an object does. Nor does it make sense for an object to be "executed", or to take "arguments" (well, unless it's an object representing a function).


You can make a block a complete function, but not allowing access to any inner variables, and you can make a block a class, by controlling what is exposed and what's not. You can make it polymorphic (this it the more advanced stuff, that beginners wouldn't even care about) where you could inherit only certain variables

ie:
  exposed inheritable int State;


If an block has a return type and or a parameter list, it is treated pretty much how a functor is treated in C++. If a block has none of those (a void return type is not the same as omitting one completely) then it is basically a class-type structure (that screams redundancy)
A block that is treated like a function, even though it IS a function, can share its exposed variables.
this allows for some interesting things to happen

blocks can return other blocks, including functions. And blocks can be built anonymously at runtime, using the Janko RTTI interface. lambda is naturally used to describe anonymous blocks. Lambda (like scheme) is what builds a block.

block block_that_returns_a_custom_block returns lambda{ ...     return lambda {            ... stuff that is returned.     }}//or return another named block blockblock other_block (int arg) returns block_that_returns_a_custom_block{     ...}


of couse this can all be horribly abused, but i'm working on that

this really makes the code easy to parse for me (my parser is VERY simple)

I have a lot of work to do yet on the language, but I am happy with how it is turning out.
I love me and you love you.
if your doing it to be simple, implement a Qbasic like language

ENGLISH is the best to use for non programmers.
you want Encapsulation.

if your doing it for the Learning experience, do whatever you like, just don't claim its for something else :D


English /QBasic like script:

function scriptStart   printout "Hello World";endobject badGuy   health;  //typeless   name;   function setName     name = setName(1); //simple argument lookup   end   function onCollision     health = health - 10;   endend

"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
I already have an existing C-like language for shaders and materials, and describing some various physics effects, so I want to keep some consistency so I can reuse most of my language.

Janko is many things
I love me and you love you.
Functions being first class objects is one of the powerful features of languages like Lisp, Scheme, ML, Dylan, etc. You're in good company. :)

This topic is closed to new replies.

Advertisement