Solved PNF: Not mangling function names right

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

des000

Thread Starter
Joined
May 29, 2008
Messages
307
I am working on modifying my computer language, Portable Numbers Format (PNF). I want to add a concept of functions to the language. It already has a concept of subroutines. Subroutines cannot be overloaded. Functions are supposed to be able to be overloaded.

There are 5 basic types in this language. VOID, BOOLEAN, NUMBER, CHARACTER and STRING. A function signature is as follows:

Code:
ret1, [ret2, ret...] funcname(param1, [param2, param...])
You see, it's pretty much like a C++ function signature, except it includes the return type and there can be multiple return values.

I studied how C++ accomplishes function overloading, and based the concept off of how that works. I mangle() the names and can also unmangle() the names. So a function that returns a STRING, and has no parameters named "a", would mangle as:

Code:
a_rSTRING_VOID
The problem appears to be that the name mangling is not sticking for all functions. What could be wrong? I checked for needing to return a reference, and don't believe that this is the cause. I could give more details upon being needed. Thanks!
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
Problem #1 solved. The function stack; Function_Stack::itsstk was being built wrong. Arrays start at 0. It was building it by first insert()ing an index, and then storing the data for add_function(). I think now it's better with it only adding before if the length() is != 1, and insert()ing afterward if length() is == 1. Except for upon reviewing, I would say that initially it adds too much. I will need to rethink this algorithm again.
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
This may fix problem #2, which is that it isn't executing all functions.
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
Okay. Now I definitely have problem #1 solved. Problem #1 is that the Function_Stack (itsstk) isn't being built right.
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
Problem #2, is sort of back to the original problem, which things are now a little closer to being fixed though. But the problem now is that it is not mangling right all the time, but only for the first function.
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
So, problem #2 is that it matters which order the function information is in.
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
Problem #3 is that I need new instructions for calling a function within another function.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top