Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Classification of new language

  1. #1
    Groogy's Avatar
    Groogy is offline Programmer
    Join Date
    May 2009
    Location
    Sweden
    Posts
    181
    Rep Power
    11

    Classification of new language

    Oi! I've been searching and searching unable to find where to get my question answered so I decided to give a shot here.

    I've created a language that I call Madness Script and is a hobby project. Now I've tried to find some way to classify it though with no prevail. I know it's dynamic typed and safe-typed. It's partly objective based on Ruby's version of Smalltalk messaging. With partly objective I mean that there exists objects and you can send a "message" to the object by a dot-notation to invoke a method.

    So far I got it covered but then here comes the tricky part. Control-structures like if or while exists as objects which can be attained and used like this:
    Code:
    loop = Kernel.NewLoop(#i = 0#)
    loop < Kernel.PrintLine(i)
    loop < i = i + 1 // += is not implemented yet
    loop.While(#Compare.LessThan(i 5)#)
    This will loop 5 times print the numbers of i. As far as I know it, my language is the only one that has it like this. There exists control structures that is part of the syntax, but these work more like goto statements and the Loop object uses those internally.

    Creating classes and methods at runtime in code also works like this.
    Code:
    Person = Kernel.NewDynamicClass("Person")
    
    PersonInit = Person.NewInstanceMethod("@init" "n")
    PersonInit < self.AddInstanceVariable("name" n)
    
    PersonGetName = Person.NewInstanceMethod("GetName")
    PersonGetName < name
    
    p = Person.New("John Doe")
    p_name = p.GetName()
    Kernel.PrintLine(p_name)
    Going into detail how it works can be a little messy and hope this is enough. There are some other stuff I am uncertain of, but this is the main thing that is bugging me. The best I can come up with is saying that it is... eer "Variable-based" or something like that? Since what normal languages see as part of the syntax is instead variables/objects/instances and function calls.

    Then there is the "reflective" part. the <-operator allows to insert code into an object and you can access the inheritance table and the associated methods to each class trough methods of the objects of either the instance or the class.

    I might be very wrong about some parts. I do not go to any computer-science classes or anything like that. Everything I know has been learnt by hand trough books or internet.

    I hope I didn't post this under the wrong category and any help or comment is appreciated. If you think my language is ineffective in it's syntax/structure then I want you to keep in mind that as I told you before, it's a hobby project and is not meant to be able to compete with real languages.

    If you need more information you can most probably find it on my website but since I have a post count less than 10, it doesn't let me post the link.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Classification of new language

    It looks like it's an object-oriented scripting language. It doesn't quite feel like it's a functional language. Clearly, it's as seems to have structured/procedural language support as well.

    The only real critique I can see is your mechanism for declaring methods of classes. I would think something like this would be clearer:
    Code:
    Person = Kernel.NewDynamicClass("Person")
    
    Person < Init = Person.NewInstanceMethod("@init" "n")
    Person < Init < self.AddInstanceVariable("name" n)
    
    Person < GetName = Person.NewInstanceMethod("GetName")
    Person < GetName < name
    
    p = Person.New("John Doe")
    p_name = p.GetName()
    Kernel.PrintLine(p_name)
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Groogy's Avatar
    Groogy is offline Programmer
    Join Date
    May 2009
    Location
    Sweden
    Posts
    181
    Rep Power
    11

    Re: Classification of new language

    Quote Originally Posted by WingedPanther View Post
    It looks like it's an object-oriented scripting language. It doesn't quite feel like it's a functional language. Clearly, it's as seems to have structured/procedural language support as well.

    The only real critique I can see is your mechanism for declaring methods of classes. I would think something like this would be clearer:
    Code:
    Person = Kernel.NewDynamicClass("Person")
    
    Person < Init = Person.NewInstanceMethod("@init" "n")
    Person < Init < self.AddInstanceVariable("name" n)
    
    Person < GetName = Person.NewInstanceMethod("GetName")
    Person < GetName < name
    
    p = Person.New("John Doe")
    p_name = p.GetName()
    Kernel.PrintLine(p_name)
    Hmm I like the idea! Though it would mean that you have to at the end tell the object to "compile" the code that is in it's scope. It's something that I didn't explain as I didn't see the need for it. Every object got it's own scope (Like in C++ you got Global scope and function scope) and the <-operator let's you put some code into that scope but it won't be executed until explicitly told to run it(Compare with the loop example) So something like?

    Code:
    Person = Kernel.NewDynamicClass("Person")
    
    Person < Init = Person.NewInstanceMethod("@init" "n")
    Person < Init < self.AddInstanceVariable("name" n)
    
    Person < GetName = Person.NewInstanceMethod("GetName")
    Person < GetName < name
    
    Person.Compile()
    
    p = Person.New("John Doe")
    p_name = p.GetName()
    Kernel.PrintLine(p_name)
    Thanks for the reply. What do you mean with this?
    it's as seems to have structured/procedural language support as well.
    Is that like, how C is?

  5. #4
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Classification of new language

    C++ is an example of a multi-paradigm language. The code within a function/method is procedural (or structured). Support for classes makes it OOP. Support for templates makes it generic. C is a good example of procedural but not OOP/generic. Haskell would be an example of functional.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  6. #5
    Groogy's Avatar
    Groogy is offline Programmer
    Join Date
    May 2009
    Location
    Sweden
    Posts
    181
    Rep Power
    11

    Re: Classification of new language

    Okay. So you could say that it follows C++ example? Except for being Generic. I don't feel the need for generic paradigm. Since the type is determined at run-time and all objects inherit from "Object".

    Having the syntax minimal and keeping common syntax structures as variables/objects doesn't change anything? All syntax will in the next version also be capable of being overridden by objects making it possible to rewrite the whole language if wanted trough the actual script-language without writing anything in the source code of the interpreter.

  7. #6
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Classification of new language

    Redefining the language could be interesting.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  8. #7
    Groogy's Avatar
    Groogy is offline Programmer
    Join Date
    May 2009
    Location
    Sweden
    Posts
    181
    Rep Power
    11

    Re: Classification of new language

    Yeah thought so too. It would be something like this (I'm currently working on the details so this is just a draft)

    Code:
    EqualOverride = self.NewMethod("@=" "value" "newValue") < newValue // Since we override the = sign we need to make it first return the newValue to get the normal operation
    EqualOverride < Kernel.PrintLine(value " = " newValue)
    EqualOverride < newValue
    
    var = 5 // Will print out '(nil) = 5'
    var = var + 1 // Will print out '5 = 6'
    
    PlusOverride = self.NewMethod("+" "value") // This will print out '(nil) = <LoadedFile.+:0xAdress>'
    PlusOverride < Kernel.PrintLine(self " + " value)
    
    self + 5 // This will print out '<LoadedFile:file.script> + 5'
    @ signifies private methods normally in my language so I thought that it would also be suitable to represent other internal things of objects. So a '@operator'-method is applied to all operations internally while a 'operator'method is only applied to operations concerning the object.

    Now.. what kind of paradigm is this? Is there even a paradigm for this? If not what could it be called? Variable-syntax paradigm?

    ** EDIT **
    Forgot that this applies to literal values too like numbers and strings. So objects can override these too. This applies to ALL syntax in the language and not just some operators which I demonstrates.
    Last edited by Groogy; 05-23-2009 at 06:53 AM.

  9. #8
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Classification of new language

    C++ has limited operator-overloading. You can't redefine default operator definitions or create new operators. It sounds like a language feature rather than a paradigm.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  10. #9
    Groogy's Avatar
    Groogy is offline Programmer
    Join Date
    May 2009
    Location
    Sweden
    Posts
    181
    Rep Power
    11

    Re: Classification of new language

    Hmm okay. Well I hoped it would fall into some kind of category under metaprogramming or something like that.

  11. #10
    hodge-podge is offline Learning Programmer
    Join Date
    Jun 2009
    Location
    New Hampshire.
    Posts
    47
    Rep Power
    0

    Re: Classification of new language

    Does its category really matter? >.> <.<

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 10-21-2011, 01:30 PM
  2. Replies: 1
    Last Post: 10-21-2011, 01:30 PM
  3. bug in php language
    By paolodinhqd in forum PHP Development
    Replies: 8
    Last Post: 06-08-2010, 02:23 PM
  4. Best Language to Use that works with IE - Fastest language at runtime
    By j.smith1981 in forum General Programming
    Replies: 10
    Last Post: 09-18-2009, 05:46 AM
  5. Replies: 15
    Last Post: 06-06-2008, 10:43 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts