Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys,

how would i be able to assign a to a line number. here is an example code:

0 asn 'Hello World'
1 pnt 0

what this code does is that it assigns(asn) the string 'Hello World' with the line number '0' and then on the next line, it prints(pnt) that line by its line number '0' the line number is like a string or something that holds data set to it by asn(assign) and then you can use it like a string such as printing, assigning, math operations, etc. is there a way?
Posted

"Assign string to line number" sounds like gibberish. If you said "associate" or something, it could be understandable. The problem is not possibility, the problem is what makes sense and what not. The notion "assignment" in programming is quite well defined. The problem is not implementation, but the lack of concept.

—SA
 
Share this answer
 
Comments
Member 8378691 13-Apr-12 2:15am    
so....do you have an answer to my question?
Sergey Alexandrovich Kryukov 13-Apr-12 13:45pm    
Yes I do. The answer is: the question makes no sense, sorry. However, I would be glad if you prove me wrong.
--SA
Member 8378691 13-Apr-12 22:06pm    
you saw my example code, this is what i would like it to look like:

0 asn Hello World
1 pnt 0

what i would like to do, is to assign a string to a line. such as in the code, i assigned the string Hello World to line 0. then in the next line, i printed Hello World by using pnt which calls and prints the string assigned to line 0. i am trying to make my programming language but i can't figure out how to add variables and 'if' statements.
Sergey Alexandrovich Kryukov 20-Apr-12 16:45pm    
"Assign a string to a line" is a phrase that don't define a meaning. If you mean something which is understood as "assignment" in programming, one thing cannot be assigned to another, because they are of different types. Though, you can talk in terms of associations. As line are unique (in your approach), you can use System.Collection.Generic.Dictionary>LineType, ContentType<, for example line type is integer, and content type is string which goes on the right. The dictionary gives you O(1) in complexity (are you familiar with Big-O notation?), so it will return you the content by the int (or whatever) key with the speed virtually not depending on the size of the dictionary.

The paradigm of a language using line numbers as objects is possible, but enormously low-level, providing very poor development support. Even assembly languages are better, they use with labels instead. You can apply the same idea for labels. But even the labelled language is too low-level and archaic to bother about it. Is is just research for the purpose of learning, or you hope to create some good practical value in such languages? Do you have other language ideas?
--SA
Member 8378691 21-Apr-12 4:37am    
this is just one of my language ideas. my friend wants to learn how to program in assembly but he can't get a grasp on it. i have taught him Visual Basic, Visual C#, C++ and even a bit of java, but he really wants to be a computer programmer when he gets older and wants to learn assembly.

i have wondered how to teach him how to program in it, i myself know how to program in it, and i thought that if i make a programming language that uses a similar syntax to it, but it is also easy to understand and program in and still easy for me to teach. this is one of the ideas that i came up with, so can you just please help me out?
Questions like these will not be attended here as we are not interested in doing your homework.

However if you have the code for this and if you are in trouble, then some one may help. Till then sorry
 
Share this answer
 
Comments
Member 8378691 12-Apr-12 22:02pm    
what? this isn't my homework. i am only 14, check my profile if you want. do you actually think that i would be making a GUI in year 9? we don't even do I.T in year 9! i am trying to make my own CMD type thing for my GUI and i am trying to make a programming language for it also. this is what i want my programming language to be like. i got the idea from assembly. i just want to know how to assign a string to a line number and then be able to access it like a string. is that too much to ask for?
Lakamraju Raghuram 13-Apr-12 1:05am    
I really appreciate your then. But first try yourself and come back if you are struck. Put the code and come back if you are not getting what you want. That is the proper way to excel.
Member 8378691 13-Apr-12 23:45pm    
why do you think i am on here. i have tried to do things like find the number, and counting number of lines then being able to retrieve data from a specific line. all kinds of things! but i still cant do it. i am trying to make my own programming language but i cant figure out how to be able to make variables in visual basic. could you just please help?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900