Author Topic: Khavi: Updates and screenshots  (Read 7216 times)

0 Members and 1 Guest are viewing this topic.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Khavi: Updates and screenshots
« on: July 12, 2011, 08:50:27 pm »
The Khavi project is once more active, since I now have a reasonable way to debug the program.  Because writing an interpreter framework capable of interpreting serious language bytecodes like Java and Lua is a monumental task, there's obviously a lot of stuff that has to go together for it to work properly.

Uncompleted features:


  • Full multi-threading support
  • Privileges
  • Shell dependencies/interfaces
  • Interpreter run-time libraries
  • Native interfaces and external libaries
  • Boot code
  • Memory management (distinct from garbage collection)
  • Garbage collection


The Languages:

  • Java bytecode:

    Currently being written and debugged.

    Khavi will accept both specially prepared .sh3 files containing Java bytecode and normal .class files when it opens a file. However, it does not accept .jar files, mostly because I don't have enough information on them to write a parser capable of handling arbitrary files. If anyone would like to point me to some decent documentation for them, I'd be happy to consider adding support for the filetype.
     
    Quote from: Hello world
    getstatic java/lang/System/out Ljava/io/PrintStream;
    ldc "Hello, world"
    invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V
    return

  • Lua bytecode:
    Currently being written and debugged.

    Please note that the following is Lua bytecode. You can still write in Lua as long as you compile the code ahead of time. I currently use Lua for Windows as my compiler and have found it to be an excellent development environment. Khavi does not and will not interpret standard Lua files (.lua). These contain plaintext representations of the lua and are beyond the scope of the Khavi framework. In the future, extensions may be made to allow their use, but they will not be part of the interpreter itself.
     
    Quote from: Hello world
    getglobal     ; print
    loadk          ; "Hello World\n"
    call
    return
    sizek (2)
    const type 4
    string size (6)
    "print\0"
    const type 4
    string size (13)
    "Hello World\n\0"

  • Brainf*ck:
    Currently being debugged.

    This is in here mostly as a joke and because I like the language. It also has the honor of being the first 3rd party interpreted language on the Prizm.
     
    Quote from: Hello world
    ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.

  • Khavi Scripting Language (KSL):
    Incomplete. The interpreter has only been partially written.

    Khavi scripting language will be used in the native interfaces, while booting the VM, in thread management, in shell interfaces, debugging Khavi, etc... Basically, it's a language designed to be insanely fast to interpret, use as little memory as possible, and still remain editable on-calc. As the following example demonstrates, I don't expect anyone to actually want to learn it...
     
    Quote from: Potential Hello World syntax
    |0000|0001#02|0603^%48656C6C6F20776F726C640D00


Technical information:

The Khavi framework is designed to assume as little as possible about the underlying code as possible. At present, the only assumption it makes is that it is parsing an underlying bytecode.

Also, here's a simplified graph of Khavi's control flow and general structure.

Spoiler For Spoiler:


Code: [Select]
                                             Shell
                                               |
                                               |
                                              Boot
                                               /\
                                              /  \
                                          Start Fail
                                           /
                                          /
                          Install context switcher
                                          \
                                           \
                                     Allocate heap
                                           /
                                          /
                           Install Primary Thread
                                          \
                                           \
                                    Install Libraries
                                           /
                                          /
            Install Memory Management and Garbage collection
                                          \
                                           \
                                        File loader
                                           /
                                          /
                                 Create Thread
                                          \
                                           \
                               Allocate thread memory
                                           /
                                          /
                                   Execute file

This is actually slightly misleading as not all paths are shown in the network graph and not all paths are always available to be taken. For example, the control paths representing the complex native and inter-thread communication interfaces aren't shown while the components labeled as "Secondary" and "Tertiary" interpreter threads are actually only present when multiple languages are being interpreted within the same instance of Khavi. There are many other things also hidden by the graph, but it does give a general overview of the complexity of Khavi. Perhaps the best analogy would be that Khavi is a virtual computer with its own OS that runs inside of the Prizm alongside Casio-OS.


Latest release:

Sorry, no releases are publicly available at this time.
« Last Edit: August 29, 2011, 12:02:45 am by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Updates and screenshots
« Reply #1 on: July 27, 2011, 08:47:57 pm »
Okay, I'm going to be re-writing Khavi's API and internal architecture to be simpler and less intrusive. Also, Khavi will pass all programs 2 KB of RAM when they are loaded (except brainf*ck, which will get a flat 7 kb) The form in which this will be passed depends on the language and hasn't been completely decided for all supported bytecodes. If you ask for more via standard methods, Khavi will return a similar object that will also include the size of the allocated memory, an important thing on a system with only 2 MB physical RAM (I will *not* be implementing paging from flash unless it proves to be an absolutely necessary feature). Also, programs will be limited in their privileges. There will be no buffer overflows (all pointers are compared against the "end of memory" and rejected if they fall outside the valid range for that thread.) Additionally, there will be permissions on thread access. All threads will be able to talk to the main system thread, but they will only be able to interact with other threads by first politely asking for permission or edit the main thread. The reasons for this should be self-explanatory.

Anyway, progress.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Updates and screenshots
« Reply #2 on: August 15, 2011, 03:23:55 am »
I've gotten a lot of work done with the libraries and the beginnings of Khavi Scripting language. This project is just absolutely massive...
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Updates and screenshots
« Reply #3 on: September 14, 2011, 05:03:05 pm »
Yeah, looks like I royally screwed up and all of the source for Khavi is gone, along with the rest of my Hard drive. It's the one important thing I have no major backups of either...
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Updates and screenshots
« Reply #4 on: December 08, 2011, 04:41:12 pm »
Added some math stuff to Khavi's library (Sine, Cosine, floating point Floor, floating point ceiling), fixed a major bug in Khavi's floating point modulo routine, wrote a functioning process selector for the context switcher, and started on Garbage collection.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ