GithubHelp home page GithubHelp logo

aplus-jvm's Introduction

aplus-jvm

Build Status License: MIT

Simple Java Virtual Machine developed for aplus

How to run?

# Clone repository
$> git clone https://github.com/kwrx/aplus-jvm
$> cd aplus-jvm

# Configure & Build
$> ./configure --prefix=DESTDIR
$> make
$> make install

NOTE: Replace DESTDIR with your destionation path, default: /usr/local
NOTE: See ./configure --help for more infos

Example

//
// Calc.java
//                         
public class Calc {                            
 public static int Sum(int a, int b) {         
     return a + b;                             
 }                                             
}                                             
//
// main.c
//
int main(int argc, char** argv) {

    /* Initialize VM */
    avm_init();

    /* Open Calc.class */
    if(avm_open("Calc.class") == J_ERR) { 
        perror("Calc.class");
        abort(); 
    }
    

    /* Initialize context & resolve assemblies */
    avm_begin();


    j_value a, b;
    
    a.i32 = 10;
    b.i32 = 15;

    /* c = Calc.Sum(a, b); */
    j_value c = avm_call("Calc", "Sum", 2, a, b);
    
    
    /* Destroy context & all resources */
    avm_end();
    
    
    printf("The sum of %d + %d = %d\n", a.i32, b.i32, c.i32);

}

License

Copyright (c) Antonino Natale. All rights reserved.

Licensed under the MIT license.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.