apollovm 0.0.1 copy "apollovm: ^0.0.1" to clipboard
apollovm: ^0.0.1 copied to clipboard

outdated

ApolloVM is a portable VM (native, JS/Web, Flutter) that can parser, translate and run multiple languages, like Dart, Java, Kotlin and JavaScript.

ApolloVM #

pub package Null Safety

CI GitHub Tag New Commits Last Commits Pull Requests Code size License

ApolloVM is a portable VM (native, JS/Web, Flutter) that can parser, translate and run multiple languages, like Dart, Java, Kotlin and JavaScript.

Usage #

The ApolloVM is still in alpha stage. Below we can see simple examples in Dart and Java.

Language: Dart #

import 'package:apollovm/apollovm.dart';

void main() async {

  var parser = ApolloParserDart();

  var root = await parser.parse(r'''
          void main(List<String> args) {
            var s = args[0] ;
            print(s);
          }
      ''');

  if (root == null) {
    throw StateError('Error parsing Dart code!');
  }

  print('<<<<<<<<<<<<<<<<<<<< REGENERATE PARSED DART CODE:');
  print(root.generateCode());
  print('>>>>>>>>>>>>>>>>>>>>');

  // Execute parsed code, calling function `main`:
  root.execute('main', [
    ['foo!', 'abc']
  ]);
}

Note: the parsed function print was mapped as an external function.

Language: Java8 #

import 'package:apollovm/apollovm.dart';

void main() async {
  var parser = ApolloParserJava8();

  var root = await parser.parse(r'''
        class Foo {
           static public void main(String[] args) {
             String s = args[0] ;
             print(s);
           }
        }
      ''');

  if (root == null) {
    throw StateError('Error parsing Java8 code!');
  }

  print('<<<<<<<<<<<<<<<<<<<< REGENERATE PARSED JAVA CODE:');
  print(root.generateCode());
  print('>>>>>>>>>>>>>>>>>>>>');

  root.getClass('Foo')!.execute('main', [
    ['foo!', 'abc']
  ]);
}

Note: the parsed function print was mapped as an external function.

See Also #

ApolloVM uses PetitParser for Dart (a very nice project) to define language grammar and parse source code.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Contribution #

Any help from open-source community is always welcome and needed:

  • Found an issue?
    • Fill a bug with details.
  • Which a feature?
    • Open a feature request.
  • Are you using and liking the project?
    • Prommote the project: create an article, post or a donation.
  • Are you a developer?
    • Fix a bug and send a pull request.
    • Implement a new feature.
    • Implement/improve a language support.
  • Have you already help in any way?
    • Many thanks from me, the contributors and everybody that uses this project!

Author #

Graciliano M. Passos: gmpassos@GitHub.

License #

Apache License - Version 2.0

42
likes
0
pub points
31%
popularity

Publisher

unverified uploader

ApolloVM is a portable VM (native, JS/Web, Flutter) that can parser, translate and run multiple languages, like Dart, Java, Kotlin and JavaScript.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, petitparser, swiss_knife

More

Packages that depend on apollovm