Thursday, November 26, 2009

How about a new interpreter language similar to Delphi?

I'm thinking for a long time about creating a interpreted language with the hope that will improve application development by at least 200%, you might think I'm joking now or that I'm out of my mind, but read on and you will understand how development time decreases.
Did you know that you "waste" somewhere between 5 and 10% of your time writing variable types? I mean
var myvar : TMyType;
how about the time wasted "asking" Google to help you with your question? Oh... not to mention about the bad names(in most programming and interpreted languages) for functions classes, i.e. writeln, readln, print, printf, strcpy, etc.
Anywayz I don't want to waste more of your time with this kind of stuff, I'm pretty sure you got the idea until now.
Here's the grammar(until now for my "to be" interpreted language")
Language: Turbo
application|console IDENTIFIER

  include|import|use|uses 'filename.extension';// not sure yet about the include

  var IDENTIFIER[, IDENTIFIER1, IDENTIFIERN];

  class IDENTIFIER extends|for IDENTIFIER

    private|public

      var IDENTIFIER[, IDENTIFIER1, IDENTIFIERN];

      function IDENTIFIER(PARAMETER[, PARAMETER1, PARAMETER2])
      end; {function}

  end; {class}

  function IDENTIFIER(PARAMETER[, PARAMETER1, PARAMETER2])
    var IDENTIFIER[, IDENTIFIER1, IDENTIFIERN];
    | code
  end; {function}

If statement

  if CONDITION then
    |
  end; {if}

  if CONDITION then
    |
  else
    |
  end; {if]

For statement

  for var index :=|= INTEGER VALUE to|downto INTEGER VALUE [step INTEGER VALUE] do
    | in the for loop you can assign the value of "index" variable
    | as in good old Pascal
  end; {for}

While and repeat statements
  while CONDITION do
    |
  end; {while}

  repeat
    |
  until CONDITION; {repeat}

Case

  case VALUE[INTEGER, STRING, CHAR] of
    IDENTIFIER|[INTEGER|STRING|CHAR VALUE]:
      |
    end; {IDENTIFIER|[INTEGER|STRING|CHAR VALUE] case}
    else
      |
    end; {else case}
  end; {case}

Try
-- there can be 4 types of tries
1:
  try
    | just try to execute code nothing else matters
  end; {try}

2:
  try
    | execute code and execute except block on exception
  except
    |
  end; {try}

3:
  try
    | try to execute code, no matter what, the code in finally
    | block gets executed
  finally
    |
  end; {try}

4:
  try
    | try to execute code, handle exception and execute finally block
    | like two nested tries in Delphi
  except
    |
  finally
    |
  end; {try}

Initialization and finalization of a include file or application|console

  initialization
     |
  finalization
     |

end; {application|console}
As you can see there are no begins I consider as wasting time to write, any declaration ends with end keyword.
The main idea is that all function/class names tell you what it actually does, for instance StringCopy, to copy a part from a string and Console.WriteLine(I know it's like delphi combined with .NET, but it actually looks clean!).
I think it will be created in Delphi but compiled with Freepascal so it can go cross platform baby!
Anyways, I really want to read your opinions and maybe start the project with someone.

4 comments:

  1. Can you tell me why do you want to go for pascal syntax?

    According to me it is very old and being highly verbos it requires more typing compared to say C# (or BASIC for that matter).

    What have you thought about the UI part. How will you preresent forms, etc. and which control framework you will want to use? Are you going to develop your own?

    I would suggest you to give this deep thought.

    ReplyDelete
  2. "Can you tell me why do you want to go for pascal syntax?"
    Pascal is the way to go in order for other programmers and novice to be able to program without searching for matching bracket in code ex. if you replace "{" and "}" with "begin" and "end", you will notice that a lot of people can understand your code even without having programming skills whatsoever.
    "According to me it is very old and being highly verbos it requires more typing compared to say C# (or BASIC for that matter)."
    Yes it does, that's why I'm trying to strip out anything that's not very useful, for instance
    if CONDITION then CODE end;
    is better than
    if CONDITION then begin CODE end;
    because you check if a condition is true and then give a list of statements to be executed.
    "What have you thought about the UI part. How will you prere... Are you going to develop your own?"
    The UI part is less significant and easy to implement, you can always take delphi's vcl and forward it into a dynamic class which can be easily accessed.
    I am thinking of implementing the UI myself by making it full Unicode.
    "I would suggest you to give this deep thought."
    Yes, I am giving it a deep thought, that's why I ask for other peoples opinion, if they/you would want to program in such a language.
    I thank you for your comment and hope you continue as part of the project or at least contribute with opinions.

    ReplyDelete
  3. Hello, I agree with you that a lot of methods have very lousy names and would be better to write the full name for better understanding in the future, but I also like the c syntax better, you should consider writing a grammar similar to C.

    ReplyDelete
  4. I see, I really do not understand why programmers love javascript/C#/C++/Java and similar languages...
    I will think of a grammar for "Turbo" similar to all those mentioned above sometime this week.

    ReplyDelete

Blogroll(General programming and Delphi feeds)