Ternary C-like programming language
Moderator: haqreu
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary C-like programming language
Well, I hope you'll be able to solve the issues soon. I'm very interested in using the language to develop programs.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary C-like programming language
Yeah, hopefully it won't be more than a few weeks. But then again, things in programming usually take longer than you expect them to, even when you expect them to take longer than you expect (Hofstadter's law).
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary C-like programming language
Yes, I know about the law 

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary C-like programming language
I've changed my mind on the static vs. dynamic variables, and added a separate software implemented variable stack so that dynamic variables can work like in regular C. It's still only 729 trytes big, so it's going to be necessary to keep any sort of larger array or struct out of it by making it static.
I've put a lot of work into 3CC the last few days trying to get this to work, and it is almost in working order now. It's not in CVS yet, because it's not stable enough, but the diff between CVS and local tree is already over a thousand lines long, so there is a lot of changes being done.
I've put a lot of work into 3CC the last few days trying to get this to work, and it is almost in working order now. It's not in CVS yet, because it's not stable enough, but the diff between CVS and local tree is already over a thousand lines long, so there is a lot of changes being done.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary C-like programming language
Finally got dynamic variables into working order. The final diff landed on about 1100 lines. I'm sure it's got bugs lurking in it somewhere, and it could do with a real clean up, but at least the memory image compiles and runs seemingly fine.
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary C-like programming language
Wow! Great work!
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary C-like programming language
Yeah, it was a lot of work.
Now I've added initializers for structs (and nested datatypes). So, stuff like
works, and foo.a becomes 1, foo.b becomes 2, foo.c.d becomes 3, foo.c.e becomes 4. It went surprisingly smooth.
I just have to add support for the same type of initialization for arrays, and fix some other stuff with variable declaration and initialization that is acting up, do some bug testing and clean ups; and then 3CC hopefully should be ready for release .
Now I've added initializers for structs (and nested datatypes). So, stuff like
Code: Select all
struct nestedstruct {
int d;
char e;
};
struct structwithnedstedstruct {
int a;
char b;
struct nedstedstruct c;
}
struct structwithnedstedstruct foo = { 1,2,{3,4} };
I just have to add support for the same type of initialization for arrays, and fix some other stuff with variable declaration and initialization that is acting up, do some bug testing and clean ups; and then 3CC hopefully should be ready for release .

-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary C-like programming language
Do you have kind of test source, that could be used to check compilation ?
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary C-like programming language
How do you mean, to check if 3CC compiles, or to check if 3CC works as it should?
The former is pretty much tunguska_3cc in the cvs. The latter is memory_image_3cc in the cvs. Though, it's not a complete test set, it's just to check for major issues. I'll be working on a more controlled test code when I'm done with these changes and go into the debug/test phase.
The former is pretty much tunguska_3cc in the cvs. The latter is memory_image_3cc in the cvs. Though, it's not a complete test set, it's just to check for major issues. I'll be working on a more controlled test code when I'm done with these changes and go into the debug/test phase.
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary C-like programming language
Well, I was asking about second - to be sure that 3CC works as it should work.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary C-like programming language
Besides memory_image_3cc (which is mostly to test that what I'm working on currently doesn't mess up the other already existing features of the language), I typically write a test case for the feature I'm currently working at.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary C-like programming language
Finally, arrays are in and working as they are supposed to.
So now I'm just crossing some Ts and dotting some Is: Optimizing, cleaning up and looking for bugs.
So now I'm just crossing some Ts and dotting some Is: Optimizing, cleaning up and looking for bugs.
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary C-like programming language
I'm glad to know about progress 

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary C-like programming language
More progress yet. I've added character constants, like say 'T', and optimized array/struct access so that it at least twice as fast -- if not faster 

-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary C-like programming language
Is this possible now to add something like custom code generator which will be used to generate bytecode for something other than Tunguska ? Or shall I think about simple converter from Tunguska compiled code to something like 'open ternary executable code' file, which will just find'n'replace chuinks of code ?