Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Programming language idea (not a question)  (Read 7554 times)

0 Members and 1 Guest are viewing this topic.

Linux711

    Topic Starter


    Mentor

    Thanked: 59
    • Yes
    • Programming Blog
  • Certifications: List
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Programming language idea (not a question)
« on: November 21, 2009, 09:32:01 PM »
This is my idea for a programming language. I came up with it during a free period at school. It will be implemented as an interpreter in C++. I tried to design it so that it would be easy to program the interpreter. That's why it is made up of combinations of single characters. It is almost impossible to understand without reading what each character means. Please comment on it.

Vars:

     * There are variables a-z and a stack
     * Each of the a-z variables has 5 data types (total of 130 vars; 26 per array)
     * The data types are string, bool, int, long, char

     The data types are accessed this way:
          VS - vars.string
          VB - vars.bool
          VI - vars.integer
          VL - vars.long
          VC - vars.character

     The stack is accessed like this:
          SS - stack.size (for all data types)
          ST - stack.type
          SA - stack.add (same as push in assembly)
          SR - stack.remove (same as pop)
          SO - stack.obtain (get without popping; only for top stack item)

     Examples:
          VSA"Hello World!" - puts the string 'Hello World!' into vars.string.a
          ---------------------------
          SS10 - stack is size 10
          STB - changes to bool

Commands/Reserved Words (Chars)

     CO - command.output
     CI - command.input
     CS - command.screen (mainly used to clear screen)
          CCT - command.compare.true?
          CCF - command.compare.false?
          CCG - command.compare.greater?
          CCL - command.compare.less?
          CCE - command.compare.end

     Example:
          VIA350 - the integer a is set to 350
          VSA"A is equal to 350." - the string a is set to ...
          CCTVIA,350 - integer a is compared with 350
          COVSA - if true, the string a is output
          CCE - end compare

Loops:

     For like loop:
          >#3 (code goes here) < - loops three times
          >VII (code goes here) < - loops i times

     While like loop:
          >CCTVBX,1 (code here) <CCE - loops while the bool x is true (1=true,0=false)
          >CCGVIX,VIY (code here) <CCE - loops while int x is greater than int y

     It can also be done like this:
          >CCGVIX,VIY
          ....
          ....
          ....
          <CCE

If you are still reading this, thank you. It is not even close to done. I think I may need to add semicolons or something to separate commands in a single line loop.

So what do you think?
YouTube

"Genius is persistence, not brain power." - Me

"Insomnia is just a byproduct of, "It can't be done"" - LaVolpe

BatchFileCommand



    Hopeful
  • Thanked: 1
    Re: Programming language idea (not a question)
    « Reply #1 on: December 01, 2009, 04:05:43 PM »
    Well, I don't think that it is necessary for you to have long and complicated commands.

    Quote
    VSA"Hello World!" - puts the string 'Hello World!' into vars.string.a

    It would pose a problem doing commands like this. There needs to be some kind of separator or something to identify the variable A and it's contents, "Hello World!". I think it would be best to stick to something like var.str.a = "Hello World!"
    οτη άβγαλτος μεταφ βαθμολογία

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: Programming language idea (not a question)
    « Reply #2 on: December 01, 2009, 05:25:35 PM »
    Well, I don't think that it is necessary for you to have long and complicated commands.

    It would pose a problem doing commands like this. There needs to be some kind of separator or something to identify the variable A and it's contents, "Hello World!". I think it would be best to stick to something like var.str.a = "Hello World!"

    um...there are only one character variables- so VS<character>"value" That's pretty easy to parse.

    I was trying to dereference Null Pointers before it was cool.

    BatchFileCommand



      Hopeful
    • Thanked: 1
      Re: Programming language idea (not a question)
      « Reply #3 on: December 01, 2009, 06:36:27 PM »
      Quote

      um...there are only one character variables- so VS<character>"value" That's pretty easy to parse.

      Okay, so it wouldn't matter. But using commands like that is going to curse you with unmaintainable code. I don't like it.
      οτη άβγαλτος μεταφ βαθμολογία

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: Programming language idea (not a question)
      « Reply #4 on: December 01, 2009, 06:37:59 PM »
      I would think it's more a practice in string parsing and language theory then an attempt to make a feasible programming language  ::)
      I was trying to dereference Null Pointers before it was cool.

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: Programming language idea (not a question)
      « Reply #5 on: December 01, 2009, 06:47:56 PM »
      Hey, go easy on him. He is learning as he goes.
      Yes, he could make is a lot more simple. But why? If you learns from the process, let him do it.
      Multiple stacks are seldom needed. But if you want them and it makes you feel good, do it!
      As for parsing, you can parse almost anything.
      Except plain English.

      itburnswhenipee



        Beginner

        Thanked: 1
        Re: Programming language idea (not a question)
        « Reply #6 on: December 06, 2009, 06:56:43 PM »
        wouldnt it be easier just to use assembly? faster anyway...

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: Programming language idea (not a question)
        « Reply #7 on: December 06, 2009, 07:00:02 PM »
        wouldnt it be easier just to use assembly? faster anyway...

        I would think it's more a practice in string parsing and language theory then an attempt to make a feasible programming language 
        I was trying to dereference Null Pointers before it was cool.

        itburnswhenipee



          Beginner

          Thanked: 1
          Re: Programming language idea (not a question)
          « Reply #8 on: December 06, 2009, 07:02:22 PM »
          thats weird, i was reading, i skipped yours and read the next one...

          Linux711

            Topic Starter


            Mentor

            Thanked: 59
            • Yes
            • Programming Blog
          • Certifications: List
          • Computer: Specs
          • Experience: Experienced
          • OS: Windows 7
          Re: Programming language idea (not a question)
          « Reply #9 on: December 07, 2009, 09:44:39 AM »
          Quote
          I would think it's more a practice in string parsing and language theory then an attempt to make a feasible programming language
          You're right.

          Quote
          Yes, he could make is a lot more simple. But why? If you learns from the process, let him do it.
          A lot more simple. How do you mean?
          Do you mean easier to read? It's not meant to be easy to read, but easy to interpret.

          Also, how do I make libraries in my programming language? If there are too many different ways to explain, then how do they do it in C?

          Anyway, thanks for the replies.
          « Last Edit: December 07, 2009, 09:56:24 AM by Linux711 »
          YouTube

          "Genius is persistence, not brain power." - Me

          "Insomnia is just a byproduct of, "It can't be done"" - LaVolpe

          BC_Programmer


            Mastermind
          • Typing is no substitute for thinking.
          • Thanked: 1140
            • Yes
            • Yes
            • BC-Programming.com
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Windows 11
          Re: Programming language idea (not a question)
          « Reply #10 on: December 07, 2009, 11:03:31 AM »
          for a library you could allow for different functions; for example, you could have a "CALL" instruction- for example:

          Code: [Select]
          VSA"string"
          CALL UPCASE

          the CALL'd functions could then work with variables in predefined locations, for example, in this case, perhaps UPCASE uppercases whatever is in VSA. Again- similar to assembly, since almost all Assembly interrupts access/modify registers to perform their task. This type of thing could easily be extended to basic functions as well, such as ADD, SUB, etc.
          I was trying to dereference Null Pointers before it was cool.

          Geek-9pm


            Mastermind
          • Geek After Dark
          • Thanked: 1026
            • Gekk9pm bnlog
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 10
          Re: Programming language idea (not a question)
          « Reply #11 on: December 07, 2009, 11:10:02 AM »
          Creation of a library is not alwasy needed. I mean you do not have to make your own lirary manager. Just use one that is already available. You can build a libray in almost any system-level language. The idea is to reduce that size of the compiled EXE file by not including the kitchen sink.
          Or, the alternative, is to have a run-time library. This is a masive hunk of code that is loaded at run time, the needed parts are lcopied into the work area memory.  This is a pratical way to smake things simple.
          For example, a specific program does not use the floading-point stuff. It is in the library, but it is not loading into the program memory because it is not neeed. But if another program needes it, it will be loaded for that program to use.

          BC_Programmer


            Mastermind
          • Typing is no substitute for thinking.
          • Thanked: 1140
            • Yes
            • Yes
            • BC-Programming.com
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Windows 11
          Re: Programming language idea (not a question)
          « Reply #12 on: December 07, 2009, 11:11:39 AM »
          it's an interpreter, I don't think there are any plans to make a compiler for it. Therefore all the core stuff such as floating point and string parsing or whatever else they choose can be placed within the interpreter.
          I was trying to dereference Null Pointers before it was cool.

          aiko



            Rookie
          • ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
          • Thanked: 1
            Re: Programming language idea (not a question)
            « Reply #13 on: December 18, 2009, 02:04:41 PM »
            i think it is impassible to do this all alone you need someone else you need a lot of people to make commands to program to test and more it's impassible but don't give up it could happen if you have a lot of people to work with and i think it is impassible to do alone

            aiko



              Rookie
            • ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
            • Thanked: 1
              Re: Programming language idea (not a question)
              « Reply #14 on: December 18, 2009, 02:06:42 PM »
              by the way you need to write exe files too...
              i can help you if you want ... :)

              BC_Programmer


                Mastermind
              • Typing is no substitute for thinking.
              • Thanked: 1140
                • Yes
                • Yes
                • BC-Programming.com
              • Certifications: List
              • Computer: Specs
              • Experience: Beginner
              • OS: Windows 11
              Re: Programming language idea (not a question)
              « Reply #15 on: December 18, 2009, 03:23:38 PM »
              i think it is impassible to do this all alone you need someone else you need a lot of people to make commands to program to test and more it's impassible but don't give up it could happen if you have a lot of people to work with and i think it is impassible to do alone

              No, it's actually quite "passible". it's a good little one-man project.

              I was trying to dereference Null Pointers before it was cool.

              aiko



                Rookie
              • ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
              • Thanked: 1
                Re: Programming language idea (not a question)
                « Reply #16 on: December 19, 2009, 03:04:23 PM »
                yeah i know, but what i mean is
                if he/she want to do this you need to have more people else it's to much

                Geek-9pm


                  Mastermind
                • Geek After Dark
                • Thanked: 1026
                  • Gekk9pm bnlog
                • Certifications: List
                • Computer: Specs
                • Experience: Expert
                • OS: Windows 10
                Re: Programming language idea (not a question)
                « Reply #17 on: December 19, 2009, 04:14:50 PM »
                 Right here!
                We will help the OP.
                http://en.wikipedia.org/wiki/Tiny_C_Compiler
                That is a start. You can see how somebody else did a very small C interpreter.
                cats of course, he does not have to duplicate that effort. That would be pointless. But it should increase him to see how that that individual along with others developed a very small implementation of a language that is considered to be rather difficult.
                In the original poster could call his new language almost anything he wants. There are no fast and hard rules about how you do something for your own entertainment. As long as it does not infringe on the rights of others.
                Also, the language does not even have to be complete. It does not have to pass any academic standard. It does not have to be flawless. If it produces some result that pleases the creator, that is good. Whether or not other people would approve should not be the criteria. Now some point, he might want to publish his work. That would be another issue.
                A simple interpreter with a built-in line editor can be made in about all I would say, maybe just under 3000 lines of code. I just don't remember. That was a long time ago when I did that.

                BC_Programmer


                  Mastermind
                • Typing is no substitute for thinking.
                • Thanked: 1140
                  • Yes
                  • Yes
                  • BC-Programming.com
                • Certifications: List
                • Computer: Specs
                • Experience: Beginner
                • OS: Windows 11
                Re: Programming language idea (not a question)
                « Reply #18 on: December 19, 2009, 10:39:41 PM »
                yeah i know, but what i mean is
                if he/she want to do this you need to have more people else it's to much

                No. It isn't, actually. It might be overwhelming if they had no design; but they have already planned out a good bit of the project, and once you have a good design the programming behind it often comes a lot easier.

                Oh, and I wrote a far more comprehensive and complicated Script language myself.. one person. It literally took a single night after good design much like the original posters, whereas many of my other whimsy project that I go into without any real plan take ages, and even then I usually end up scrapping it all and starting again with the design stage.
                I was trying to dereference Null Pointers before it was cool.

                Geek-9pm


                  Mastermind
                • Geek After Dark
                • Thanked: 1026
                  • Gekk9pm bnlog
                • Certifications: List
                • Computer: Specs
                • Experience: Expert
                • OS: Windows 10
                Re: Programming language idea (not a question)
                « Reply #19 on: December 20, 2009, 11:53:47 AM »
                Quote
                It literally took a single night after
                good design much like the original posters
                That's right on target!