nedoPC.org

Community of electronics hobbyists established in 2002

...
Atom Feed | View unanswered posts | View active topics It is currently 19 Jul 2018 15:32



Reply to topic  [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
[Ternary] Ternary C-like programming language 
Author Message
Retired

Joined: 03 Aug 2003 23:37
Posts: 1481
Location: Moscow
Reply with quote
Well, I hope you'll be able to solve the issues soon. I'm very interested in using the language to develop programs.


30 Sep 2008 12:30
Profile
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
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).


30 Sep 2008 13:17
Profile
Retired

Joined: 03 Aug 2003 23:37
Posts: 1481
Location: Moscow
Reply with quote
Yes, I know about the law :)


30 Sep 2008 14:38
Profile
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
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.


03 Oct 2008 14:53
Profile
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
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.


05 Oct 2008 12:16
Profile
Retired

Joined: 03 Aug 2003 23:37
Posts: 1481
Location: Moscow
Reply with quote
Wow! Great work!


06 Oct 2008 13:07
Profile
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Yeah, it was a lot of work.

Now I've added initializers for structs (and nested datatypes). So, stuff like

Code:
struct nestedstruct {
  int d;
  char e;
};
struct structwithnedstedstruct {
  int a;
  char b;
  struct nedstedstruct c;
}
struct structwithnedstedstruct foo = { 1,2,{3,4} };


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 . :-D


06 Oct 2008 15:11
Profile
Retired

Joined: 03 Aug 2003 23:37
Posts: 1481
Location: Moscow
Reply with quote
Do you have kind of test source, that could be used to check compilation ?


08 Oct 2008 03:52
Profile
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
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.


08 Oct 2008 04:30
Profile
Retired

Joined: 03 Aug 2003 23:37
Posts: 1481
Location: Moscow
Reply with quote
Well, I was asking about second - to be sure that 3CC works as it should work.


09 Oct 2008 14:47
Profile
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
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.


10 Oct 2008 07:00
Profile
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
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.


12 Oct 2008 07:34
Profile
Retired

Joined: 03 Aug 2003 23:37
Posts: 1481
Location: Moscow
Reply with quote
I'm glad to know about progress :)


13 Oct 2008 00:27
Profile
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
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 :-)


16 Oct 2008 12:25
Profile
Retired

Joined: 03 Aug 2003 23:37
Posts: 1481
Location: Moscow
Reply with quote
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 ?


17 Oct 2008 03:55
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.