• Forum
  • Lounge
  • New child language - (Function member ad

 
New child language - (Function member address (structure))

Pages: 123... 20
I'm working on a big project. The project is just "my child language" because my interpreter has not been named yet. This is a C++ project; I'm using the powerful power of C++; not the power of assembly language. I'm aware that C++ is not the fastest, and implementing them certainly affects interpreter speed seriously. But C++ gives everyone a friendly look; many big projects (especially 3D games) are done by C++, because if we say "performance", then only C++ is best! And my challenge is "Let's make a whole interpreter by C++", and my project... began !

First, code warning : http://www.cplusplus.com/forum/lounge/85713/14/#msg483215
Special features :
- Construct (exp) ? (value) : (value)
- Function library manager

Here is the current progress :

(Level of developing difficulty)
- Basic calculation - Almost done
- Basic operators : (+); (-); (*); (/); (^);
- Compound assignment : OK
- Construct (exp) ? (value) : (value) : OK
- Increase - Decrease operators : OK
- Basic variable operation : OK - var *= 10
- Basic structure operation : OK - data.var *= 10
- Expression inside brackets : OK
- Returning value & access : OK - strcpy(str,"abcd")[2];
- Basic type-cast : OK - [double] 10
- (sizeof) command : In progress
- Bitwise operators : In progress
- Bit-byte operations : Not ready yet
- Shift left-right operators : Not ready yet
- Current speed : Fast
- Safety : High
- Compare with C++ (style) : A bit (type-cast), ? construct

- Variable definition - In progress
- Basic definition : (int; short; long; char; bool; float; double)
- Variable attribute : const, signed, unsigned
- Multiple definitions in a line : OK (basic) - int a, int b, int c
- Multiple definitions with the same type : OK - int a, b, c; float f, d;
- Definition with construction : OK int a = 10 + 10
- One dimensional array : OK - char str[10];
- Dimensional array with construction : In progress - char str[10] = {'a', 'b', 'c', 'd', 'e'}
- Pointer - Reference : OK
- Multiple dimensional array : In progress
- Pointer level - Reference level : In progress
- Auto type variable : In progress
- Auto pointer type variable : Not ready yet
- Container variable (vector) : In progress
- Structure variable definition : In progress
- Structure with pointer access : Not ready yet
- Accessing an element in different ways : In progress - var[10] = 10; var["string"] = 10;
- Unknown definition (void, *void) : Not ready yet
- Current speed : Fast
- Safety : High
- Compare with C++ : Structure definition, auto, multiple defintion

- Function calling - In progress
- Function type-cast : Done (basic) - [#iddc]
- Automatic type-cast : In progress
- Automatic parameter : Only handmade functions - func(int a, int b = 0)
- Function error checking : In progress (Only available in Debug version)
- Unlimited parameters : Ok (default)
- Parameter is an expression : Ok
- Call with basic different types : Ok
- Returning value : Ok (Almost done)
- Function list : In progress
- Handmade function : Not ready yet
- Local DLL call : Not ready yet
- Pointer and reference : In progress
- Parameter is structure : Not ready yet
- Current speed : Fast
- Safety : Not safe (type-cast)
- Compare with C++ : Function type-cast

- Expression, Comparison - Almost done
- Basic operators : (>); (<); (==); (!=); (>=); (<=); (!); (&&); (||);
- Multiple operations : OK
- AND expression : OK
- OR expression : OK
- Negating an expression : OK (Testing) - !(var == 10)
- Comma operator (,) : OK
- Current speed : Fast
- Safety : Very safe
- Compare with C++ : The comma operator

Continue...
Last edited on by admin
I'd like to comment my opinion but I don't really understand what you're trying to say :\

Try rewording it please?
Just another example of JM trolling.
Sorry, this is the mobile version.
I rephrased.
You mean like a scripting language? There are tons of those out there.
@You mean like a scripting language? There are tons of those out there.


No. That's not easy as you think. I tried scripting language (Javascript) but I want to create my own language.
A source file means you have to load it through memory, check every character, detect words, syntax errors, unknown variables and functions, linking errors... That's initialization. And executing commands (unknown function names, wrong parameter lists,...) in short etc

Does any one have any better method? I think no need to check too much because it's only a scripting language, not programming language. Perhaps Windows supports scripting language, but I forgot it. And, I'd like to hear some comments and opinions please....
Last edited on
it's only a scripting language, not programming language
*Sigh*

I think what you're describing is an embeddable scripting language. A host application includes in its executable the code that implements the interpreter/compiler for the language, then at run time it loads a script from somewhere, compiles it, and executes it. A very common application for scripting languages is to define a plugin interface for a larger program. For example, The GIMP's Script-Fu, Firefox's JavaScript, etc. Firefox even JITs JS code to native code for maximum performance.
So you wan't to write an interpreter.
First formally define your grammar. See http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form for a good notation
Then write a parser for that grammar. See http://en.wikipedia.org/wiki/Recursive_descent_parser for an easy kind.
At this point it gets a bit fuzzy, I think. It depends a lot on the kind of language you come up with. You might even be able to execute the parse trees. Although you should probably transform them into some more usable form. It is fairly important that you have a good idea of how that form would look like.

If you really want to compile, there are a couple mores steps to make. That would probably include a transformation into http://en.wikipedia.org/wiki/Three_address_code and then to ASM. Do you know ASM?
closed account (1yR4jE8b)
Pretty much every single interpreted language worth using does this.
This is more BULL from the OP - Look at some of the other posts by the OP. Doesn't know C++, not very good at C either IMO, and now wants to write her? own interpreter ????

As I said earlier - just more trolling. IMO, don't waste your energy replying to this nonsense.
@TheIdeasMan
Listen to me, TheIdeasMan
I'm not silly, or crazy, or insane. Because this may be a good idea so I decided to try my attempt. But I'd like to hear "what people think about" first, not your comments. Your comments are irrelated to this topic. I want you to stop making noise here, and do not comment incorrect things unless this discussion or this thread or one of my comment is really bad , that's lounge, you may ignore it.
You said I'm trolling as you think my idea is ... Crazy? Insane? Silly? Mad? Unusual? Or anything else?
Again, you should remember : "beware of your mouth" before typing anything...

Regards
Last edited on
@Jackson Marie

Well, I do find your goal to be bizarre.

As I said, you don't know C++ - you write C programs with cout & cin. Yesterday you had a post about the use of vectors - if can't work this out yourself - then how are you going go doing something much much harder. Your C programs quite often don't work, are badly formatted & hard to read. Now you want to write you own interpreter????

Do you have any idea of what is involved in writing your own interpreter? No is the obvious answer.

It is a bit like someone who has never driven a car, and tomorrow wants to do Formula One.

I (& others) would be interested to hear what your actual programming background is.

Why do I suspect you of being a troll (or at least a nuisance):

- Bad advice;
- Poorly formatted, hard to read code;
- Criticism of senior & knowledgeable members of this site;
- No demonstration of ability, followed by wanting to do something major like an interpreter.

All these things look like they are designed to provoke comment and waste peoples time, and that is the definition of a troll.

So what if this is not the case? Then maybe you can think about these things:

- Don't make out that you have enough knowledge to help others, then provide bad advice.
- If you are going to post code, make sure it is formatted properly, make sure it compiles, make sure it works by testing it properly.
- Be very careful about criticising senior members on this site - Instead think carefully about what they are saying.
- If you want to find out about advanced topics, then ask a question about how it works, rather than saying you are going to do it - then criticise a senior member (like firedraco (5360) in this thread)
- Think about how others are going to view your posts - are you surprised that some of us (I am not the only one) are very skeptical about you and your posts in general?

Now a disclaimer: I have made some mistakes while posting here. Some of them are syntax errors, because I just type code straight into this window, I don't go and compile every little snippet that I post. But at least I try to give good advice (mostly to beginners), and generally stay within my own knowledge base.

Your advice seems to be deliberately confusing.

Now, why am I making all these comments? It is about quality of the forum - the more people like you there are, the more people will get their advice form elsewhere.

So I stand by the things I have said.


@TheIdeasMan, regardless of validity of your suspicions, there is no need to be so discouraging. If she wants to write an interpreter, at worst she will fail and learn something while trying.
@TheIdeasMan, regardless of validity of your suspicions, there is no need to be so discouraging. If she wants to write an interpreter, at worst she will fail and learn something while trying.

That.
@TheIdeasMan, regardless of validity of your suspicions, there is no need to be so discouraging. If she wants to write an interpreter, at worst she will fail and learn something while trying.


+1
Good point, thanks hamsterman!
Oh well, see how she goes then.

I wonder whether she will actually do anything on this - I can't wait to see what the questions are.

I won't be helping, because I don't know much about writing an interpreter, and for other reasons already alluded to.

I am glad hamsterman mentioned learning - something JM needs to do lots of, before offering terrible advice to others.

As much as I dislike inflicting JM on other websites, I dare her to try some of her "code solutions" on the Programming forum at linuxquestions.org. You think I am scathing? Wait until these guys shoot you down in flames. They have active moderators, so it shouldn't last long.

@JM - you are asking me for private information via a PM? Are you nuts? Just shows how crazy you are if you think I am going to give anyone that - let alone you. Your PM was deleted & I will never reply to them - so don't bother.
Last edited on
That. So don't bother, @TheIdeasMan. :)
Last edited on
closed account (iw0XoG1T)
This forum is very tolerant of others--that is why beginners come here. If JM is trolling you it is because you are letting him/her trying being nice or ignoring; it is much more effective.
Right, that's only an excuse. TheIdeasMan, you'd like to see my actual background programming? Why? Maybe you can tell me the difference zone between C and C++. I'm a chicken, so the basic knowledge I must know.
Thanks.
Last edited on
Pages: 123... 20