1
$\begingroup$

I am trying to do automated programming research: business software generation from the knowledge base that is implemented as Scheme (Lisp dialect) code (in the framework of http://opencog.org/ Atomspace). My question is - how to generate Java source code in academically acceptable way?

I know or I can imagine several ways:

  • Raw code generation: I can predict what classes and what members can be and create one large literal constant that is the source code.
  • Find or implement templating engine like Visual Studio's T4 templates
  • Find something about code generation from the UML models. I don't know yet how MDD tools implement such generation
  • I can genereate Java Abstract Syntax Tree in my Scheme code and then find tools generate Java source code from Java AST. Actually this could be - in my opinion - the most academically correct way that is also the best integrated in my workflow and that is the most extendable. My OpenCog Scheme Atomspace in effect is large hypergraph and Java AST is (hyper)graph to, so - AST generation reduces to the graph transformation. This seems the path to follow, isn't it?

There are some technical questions as well - are there tools that accept Java AST (in some form) and that generate Java source code? Can such AST-2-code tools be generated from the formal grammar of the programming language (https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html is example of the specification in the free, readable form)?

So - the question is - what is the best practice of code generation in the computer science academic project?

$\endgroup$
  • 3
    $\begingroup$ What does "academically acceptable" mean? $\endgroup$ – David Richerby Mar 12 '17 at 21:06
  • $\begingroup$ Method that can be accepted in thesis of publication. Raw string formation is not scalable, can not be perceived as method. $\endgroup$ – TomR Mar 12 '17 at 21:08
  • 2
    $\begingroup$ The specific method of generation probably does not matter to the reviewers. Whether the task at hand and/or ideas for solving it have enough merit to warrant publication is more important. $\endgroup$ – Raphael Mar 12 '17 at 21:11
  • $\begingroup$ My work is about business software generation from the knowledge base. I have solid knowledge representation and knowledge base but the representation of the source code and code generation is the weak member of the chain. If one member is weak then the whole workflow can be considered unacceptable. $\endgroup$ – TomR Mar 12 '17 at 21:16
  • $\begingroup$ Unfortunately, it seems to me that Eclipse JDT AST subproject is retired, is removed from the actual pages and is not updated to the latest Java version. $\endgroup$ – TomR Mar 12 '17 at 21:26
1
$\begingroup$

It highly depends on what is the domain you are working on, i.e. why do you need to generate Java Source code anyway?.

Can you explain better what knowledge do you have stored in your knowledge base?.

The most "formal" method I can think of is by using the Java grammar and generate and abstract syntax tree as you mentioned. But it may or may not be appropriate, it depends on what are the task you want to solve.

If you want to use the grammar approach you may want to check antlr, I've used it to compare AST in plagiarism detection. Here is a repository with the grammars of many languages, including Java: https://github.com/antlr/grammars-v4

$\endgroup$
0
$\begingroup$

There is no such thing as "academically acceptable" or "academically correct". That's not a thing.

Rather, what matters is whether you make a significant, novel contribution, and whether you adequately demonstrate evidence that your work does represent a significant, novel contribution.

Instead, I suggest that you focus on the requirements for your application domain, and use good engineering principles to choose a solution that has technical merit and that meets those requirements, without worrying about whether it is "academic" enough.

$\endgroup$
  • $\begingroup$ I suppose you were downvoted for "good engineering principles" and "technical merit". $\endgroup$ – gnasher729 Mar 13 '17 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.