Home / Software / Computer programming / Programming language idea (not a question)
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2  All - (Bottom) Print
Author Topic: Programming language idea (not a question)  (Read 1678 times)
Linux711
Topic Starter
Adviser



Thanked: 43
Posts: 814

Certifications: List
Computer: Specs
Experience: Experienced
OS: Windows XP

Programming Blog 1
« 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?
IP logged

YouTube

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

"The pointer of a programmer is null; something must set it to love" - Me

BatchFileCommand
Hopeful



Thanked: 1
Posts: 339




« 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!"
IP logged

οτη άβγαλτος μεταφ βαθμολογία
BC_Programmer
Mastermind


Thanked: 682
Posts: 15,624

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« 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.

IP logged

BatchFileCommand
Hopeful



Thanked: 1
Posts: 339




« 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.
IP logged

οτη άβγαλτος μεταφ βαθμολογία
BC_Programmer
Mastermind


Thanked: 682
Posts: 15,624

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« 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  ::)
IP logged

Geek-9pm
Sage



Thanked: 327
Posts: 8,047

Computer: Specs
Experience: Familiar
OS: Windows XP


Geek After Dark

« 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.
IP logged
itburnswhenipee
Beginner



Thanked: 1
Posts: 69


« Reply #6 on: December 06, 2009, 06:56:43 PM »

wouldnt it be easier just to use assembly? faster anyway...
IP logged
BC_Programmer
Mastermind


Thanked: 682
Posts: 15,624

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« 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 
IP logged

itburnswhenipee
Beginner



Thanked: 1
Posts: 69


« Reply #8 on: December 06, 2009, 07:02:22 PM »

thats weird, i was reading, i skipped yours and read the next one...
IP logged
Linux711
Topic Starter
Adviser



Thanked: 43
Posts: 814

Certifications: List
Computer: Specs
Experience: Experienced
OS: Windows XP

Programming Blog 1
« 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 » IP logged

YouTube

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

"The pointer of a programmer is null; something must set it to love" - Me

BC_Programmer
Mastermind


Thanked: 682
Posts: 15,624

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« 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.
IP logged

Geek-9pm
Sage



Thanked: 327
Posts: 8,047

Computer: Specs
Experience: Familiar
OS: Windows XP


Geek After Dark

« 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.
IP logged
BC_Programmer
Mastermind


Thanked: 682
Posts: 15,624

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« 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.
IP logged

aiko
Rookie



Thanked: 1
Posts: 33



☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆

lol
« 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
IP logged
aiko
Rookie



Thanked: 1
Posts: 33



☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆

lol
« 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 ... :)
IP logged
Pages: [1] 2  All - (Top) Print 
Home / Software / Computer programming / Programming language idea (not a question) « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.137 seconds with 20 queries.