Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Discussion about a programming language I'm creating (Kava)

kava programming language java c++ c d oop

  • Please log in to reply
27 replies to this topic

#13 0xDEADBEEF

0xDEADBEEF

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 790 posts
  • Programming Language:C, Java, C++, C#, (Visual) Basic, Perl, Transact-SQL, Bash, Prolog, Others
  • Learning:Others

Posted 19 December 2012 - 12:42 AM

I don't really agree. I think it's actually more convenient not to have that split, as I've already explained.


As long as you can extract the interface from the binary representation that is.
  • 0

Creating SEGFAULTs since 1995.


#14 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 19 December 2012 - 01:02 AM

As long as you can extract the interface from the binary representation that is.


Sure thing, I'll be able to do that (as there's space for meta-data in the binary).

Edited by Yannbane, 19 December 2012 - 01:02 AM.

  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#15 0xDEADBEEF

0xDEADBEEF

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 790 posts
  • Programming Language:C, Java, C++, C#, (Visual) Basic, Perl, Transact-SQL, Bash, Prolog, Others
  • Learning:Others

Posted 19 December 2012 - 05:49 AM

In regard to your byte code - what are you adding text into the binary itself. Comments or descriptions can be very large and should be stripped out don't you think?

Its hard to tell from your post, since you didn't spec out the full byte code; but I assume that your using a symbol table; and that various parameters are pointers to this table?

Edited by Evan, 19 December 2012 - 06:39 AM.

  • 0

Creating SEGFAULTs since 1995.


#16 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 19 December 2012 - 01:51 PM

In regard to your byte code - what are you adding text into the binary itself. Comments or descriptions can be very large and should be stripped out don't you think?

Its hard to tell from your post, since you didn't spec out the full byte code; but I assume that your using a symbol table; and that various parameters are pointers to this table?


Well, I don't believe descriptions can get that large. It seems neat to be able to access them at runtime, probably via the .__doc property or something like that. However, if it turns out to be a problem, I could remove them.

And yes, I'm using a symbol table to map instruction to into bytes.

The reason I have not fully spec out the bytecode in my blogpost is that I simply don't have a solid spec yet. Once I actually code up a minimal implementation, I will start optimizing, standardizing, and writing specifications.

But for now, it's just my code and my projects notebook. :)

Edited by Yannbane, 19 December 2012 - 01:53 PM.

  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#17 0xDEADBEEF

0xDEADBEEF

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 790 posts
  • Programming Language:C, Java, C++, C#, (Visual) Basic, Perl, Transact-SQL, Bash, Prolog, Others
  • Learning:Others

Posted 19 December 2012 - 11:32 PM

On the description front maybe you can impose a limit. If you see the size of java doc comments I'd doubt you'd want to include these in your compiled files. I can't really see what use the'd be; other than displaying to a user; so maybe if you want to have all documents bound to the code or so.

Not sure If I explained well enough what I ment by a symbol table - your answer seems to imply you use it in the translation stage.

By symbol table I was specifically talking about variables and method calls in the byte code itself. So if as part of your bytecode you call a function, say bar. Instead of the instruction being "invoke bar", its "invoke #1". Then in your table #1 = bar.

Btw; whats your startomg basis for the bytecode, RISC or somthing more complex? RISC might be interesting to look at as it defines the minimum number of instructions necessary. You can then build apon that.


Edited by Evan, 20 December 2012 - 12:41 AM.

  • 0

Creating SEGFAULTs since 1995.


#18 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 20 December 2012 - 01:16 AM

Yeah, I guess there's no need to include the description after all.

And yeah, I misunderstood what you meant by symbol table. It will work like Java, operands could be offsets in the local variable array.

The only RISC machines I ever worked with were register-based, not stack-based like Java or Kava though. Currently I'm pretty much copying Java bytecode instructions and adding a few changes of my own.

I thought of maybe making a register-based VM, though... However, I might lose my architecture independence, because different machines have different number of registers, and I'd have to recompile my code and create separate VM's in order to optimize.
  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#19 0xDEADBEEF

0xDEADBEEF

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 790 posts
  • Programming Language:C, Java, C++, C#, (Visual) Basic, Perl, Transact-SQL, Bash, Prolog, Others
  • Learning:Others

Posted 20 December 2012 - 01:39 AM

Yeah, I guess there's no need to include the description after all.

And yeah, I misunderstood what you meant by symbol table. It will work like Java, operands could be offsets in the local variable array.

The only RISC machines I ever worked with were register-based, not stack-based like Java or Kava though. Currently I'm pretty much copying Java bytecode instructions and adding a few changes of my own.

I thought of maybe making a register-based VM, though... However, I might lose my architecture independence, because different machines have different number of registers, and I'd have to recompile my code and create separate VM's in order to optimize.


I mentioned RISC mainly as I think its a minimal set of instructions. I know that the Java set is much largerl; but then they have certain things added for performance - like loading -128 to 128 as specific byte code instructions. So it might be harder to understand what is necessary and whats not. Probably best to start with a minimal set of instructions and move from there.

You could do a register VM; any system which doesn't have enough registers would mean the VM would have to emulate it. So you just define the system to have (say) 8 registers. But, you can easily translate a register based instruction set to work with a stack based. Its the meaning of the instructions rather than their implementation that's important.
  • 1

Creating SEGFAULTs since 1995.


#20 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 21 December 2012 - 04:49 AM

I mentioned RISC mainly as I think its a minimal set of instructions. I know that the Java set is much largerl; but then they have certain things added for performance - like loading -128 to 128 as specific byte code instructions. So it might be harder to understand what is necessary and whats not. Probably best to start with a minimal set of instructions and move from there.


That's a good suggestion, thanks. Once I start working actively on the bytecode, I will probably base it off some shorter set of instructions, and then expand it to optimize (current opcodes are merely placeholders).

You could do a register VM; any system which doesn't have enough registers would mean the VM would have to emulate it. So you just define the system to have (say) 8 registers.


True, I could do that. However, I'm not sure whether that's a good idea, as the number of registers may vary depending on the architecture, so I would be forced to find some optimal number of virtual registers, and that would usually mean a compromise between all the architectures which I'm planning to support (I'm only sure of the x86(_64) and AVR for now). I think a stack-based machine scales better.

But, you can easily translate a register based instruction set to work with a stack based. Its the meaning of the instructions rather than their implementation that's important.


Well the compilation is surely different, method calls would be different, I think it's not such an easy thing to change. I chose the stack, as it seems to work well for Java, and scales good, so I'll keep it there.
  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#21 0xDEADBEEF

0xDEADBEEF

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 790 posts
  • Programming Language:C, Java, C++, C#, (Visual) Basic, Perl, Transact-SQL, Bash, Prolog, Others
  • Learning:Others

Posted 21 December 2012 - 05:11 AM

Well the compilation is surely different, method calls would be different, I think it's not such an easy thing to change. I chose the stack, as it seems to work well for Java, and scales good, so I'll keep it there.


Its different, but not massively so. The instructions are hard wired in the cpu to-do certain tasks. So for example add, the cpu probably dictates which registers it will read and which ones it will write to (the instruction might have multiple overloads, but I'm guessing they are pretty fixed at the hardware level [nb this isn't my speciality so might be a little wrong])

so the assembler might be (all this is pseudo-assembler btw):

mov ax,0
mov bx,2
add  // This will add ax+bx and leave the result in ax

but for a stack its

push 0
push 2
add //This will pop the top two items and then push the result

Quite quite similar.

For function calls, I think the'd look similar as well, maybe (register:)
...
push ax
push bx // Save ax and bx to the stack, as these are our function register

mov ax 1 // This subroutine expects parameters in registers...
mov bx 2
gosub SOMESUB // gosub is what ever function runs a subroutine in assembly..

mov cx ax // This is the result value, say in ax

pop bx
pop ax

and stack

// in this versions the local variables we want are allready on the stack or in
//  an actual local variable
push 1
push 2
gosub SOMESUB
pop Var1

So to my mind they seem the same.

I think your right that the stack is the only way to-go; so I wish you luck in specification tasks. The good thing to remeber is that you can always change it if you don't like it after a while.
  • 1

Creating SEGFAULTs since 1995.


#22 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 21 December 2012 - 05:46 PM

*** News ***

I've created a website for the language: kavalang.com. Blog post about this activity, with a bit more information and explanation: http://www.yannbane....e-acquired.html.

However, it is in a pretty awful state, as you can see.

I'm not really a web designer, and don't have a lot of time to make the website a bit more usable (mostly the basic structure and colors), so everyone is invited to copy the source code of the site and make it into something just a bit better.

Thanks!
  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#23 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 22 December 2012 - 04:25 PM

Significant changes made to the website: http://kavalang.com/.

Posted Image
  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#24 nickreardon

nickreardon

    CC Newcomer

  • Member
  • PipPip
  • 15 posts

Posted 31 December 2012 - 05:09 AM

Yay! I was hoping to work on a project similar to this, but instead, I'd like to program a computer just using english. That would be nice. Just need someone to focus on it and it should be possible. For the time being though, I'm just going to have to use python.

Nick
  • 0





Also tagged with one or more of these keywords: kava, programming, language, java, c++, c, d, oop

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download