* Approach to add a new language
@ 2015-09-24 18:29 Germán Arias
2015-09-24 19:20 ` Per Bothner
0 siblings, 1 reply; 9+ messages in thread
From: Germán Arias @ 2015-09-24 18:29 UTC (permalink / raw)
To: Kawa
Hi all, I'm new at Kawa, although I have some experience in scheme, but
not in java. I read that Kawa can be used to implement other programming
languages in java platform. So I would like hear your suggestions to do
this. I'm thinking on implement Objective-C, but I don't know how this
works. Parse the objective-C files to generate the corresponding Sheme
files is enough? Or is necessary other considerations? Thanks in advance
for your help.
Germán
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Approach to add a new language
2015-09-24 18:29 Approach to add a new language Germán Arias
@ 2015-09-24 19:20 ` Per Bothner
2015-09-25 9:04 ` packaging classes in kawa Damien Mattei
2015-09-26 3:41 ` Approach to add a new language Germán Arias
0 siblings, 2 replies; 9+ messages in thread
From: Per Bothner @ 2015-09-24 19:20 UTC (permalink / raw)
To: Germán Arias, Kawa
On 09/24/2015 11:28 AM, Germán Arias wrote:
> Hi all, I'm new at Kawa, although I have some experience in scheme, but
> not in java. I read that Kawa can be used to implement other programming
> languages in java platform. So I would like hear your suggestions to do
> this. I'm thinking on implement Objective-C, but I don't know how this
> works. Parse the objective-C files to generate the corresponding Sheme
> files is enough? Or is necessary other considerations? Thanks in advance
> for your help.
Objective-C might be a challenge on the JVM, partly because C is a challenge
on the JVM. Plus you have to define a mapping from the Objective-C class/object
model to the Java model.
Perhaps you could implement a subset of Objective-C - but why?
I wouldn't use Scheme as an intermediate language (though one could).
One problem is that makes it hard to get line number information correct.
Better (and faster) to parse Objective-C and generate the Expression
objects that Kawa uses.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* packaging classes in kawa
2015-09-24 19:20 ` Per Bothner
@ 2015-09-25 9:04 ` Damien Mattei
2015-09-25 9:09 ` Damien Mattei
2015-09-26 3:41 ` Approach to add a new language Germán Arias
1 sibling, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2015-09-25 9:04 UTC (permalink / raw)
To: kawa
hello,
is there a way to package a class defined in kawa like it could be done
in java with package name; statement?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: packaging classes in kawa
2015-09-25 9:04 ` packaging classes in kawa Damien Mattei
@ 2015-09-25 9:09 ` Damien Mattei
[not found] ` <CAE4XeMCHZVDNEMeHXbBHvsgtUXTTzqknZxuTyWp0og8BWuC_mQ@mail.gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2015-09-25 9:09 UTC (permalink / raw)
To: kawa
is there a way with kawa to have java source code generated by kawa, so
i can add a package statement directly in source? (or does kawa generate
directly java byte-code?)
Le 25/09/2015 11:04, Damien Mattei a écrit :
>
> hello,
>
> is there a way to package a class defined in kawa like it could be done
> in java with package name; statement?
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: packaging classes in kawa
[not found] ` <CAE4XeMCHZVDNEMeHXbBHvsgtUXTTzqknZxuTyWp0og8BWuC_mQ@mail.gmail.com>
@ 2015-09-25 13:10 ` Damien Mattei
2015-09-25 15:15 ` Per Bothner
0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2015-09-25 13:10 UTC (permalink / raw)
To: Bruce Lewis; +Cc: kawa
great !
so the scheme modules map to java packages...
thanks,
Damien
Le 25/09/2015 13:05, Bruce Lewis a écrit :
> http://www.gnu.org/software/kawa/Module-classes.html
>
> (module-name "fr.unice.package.ThisClass")
>
>
> On Fri, Sep 25, 2015 at 5:09 AM, Damien Mattei <damien.mattei@unice.fr
> <mailto:damien.mattei@unice.fr>> wrote:
>
> is there a way with kawa to have java source code generated by
> kawa, so
> i can add a package statement directly in source? (or does kawa
> generate
> directly java byte-code?)
>
> Le 25/09/2015 11:04, Damien Mattei a écrit :
> >
> > hello,
> >
> > is there a way to package a class defined in kawa like it could
> be done
> > in java with package name; statement?
> >
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: packaging classes in kawa
2015-09-25 13:10 ` Damien Mattei
@ 2015-09-25 15:15 ` Per Bothner
2015-09-25 15:49 ` Damien Mattei
0 siblings, 1 reply; 9+ messages in thread
From: Per Bothner @ 2015-09-25 15:15 UTC (permalink / raw)
To: Damien Mattei; +Cc: kawa
On 09/25/2015 06:10 AM, Damien Mattei wrote:
> great !
>
> so the scheme modules map to java packages...
No, Scheme modules map to Java *classes*.
This is the "module class" itself. They may be additional
classes (ones defined by define-class/define-simple-class,
and "frame" classes used for closures). This are all in the same package.
The frame classes are member classes or inner classes.
A define-class is (by default) a member class of the module class;
a define-simple-class is (by default) a sibling class (unless it has
same name as the module class, in which case they are combined).
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: packaging classes in kawa
2015-09-25 15:15 ` Per Bothner
@ 2015-09-25 15:49 ` Damien Mattei
2015-09-25 16:21 ` Per Bothner
0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2015-09-25 15:49 UTC (permalink / raw)
To: Per Bothner; +Cc: kawa
i do not understand well...
i have a netbeans project for testing all those stuff:
in java file i have :
package eu.oca;
import gnu.expr.RunnableModule;
import gnu.lists.LList;
import gnu.lists.Pair;
import eu.oca.scheme.Vector2D;
...
/**
* Retrieves representation of an instance of eu.oca.serviceResource
* @return an instance of java.lang.String
*/
@GET
@Produces("text/html")
public String getHtml(
@DefaultValue("toto") @QueryParam("name") String nom
) {
Vector2D vec = new Vector2D( 1, 2);
Object[] lst = {2, 3};
double res=vec.norm();
//Object result = vec.plus.applyN(lst);
LList glst = new LList();
//glst = glst.list2(2,3); // works also
glst = LList.list2(2,3);
Object result0 = vec.plus(glst);
int r = (int) result0;
Pair pair = new Pair(2, LList.Empty);
Pair pair2 = new Pair(3, pair);
LList glst2 = new LList();
glst2 = pair2;
Object result = vec.plus(glst2);
Object result1 = vec.carre(glst);
CreateHTML html = new CreateHTML();
//TODO return proper representation object
return html.getHtml()+"<h1>REST in peace " + nom + " with "+
glst + " r = "+ r +" glst2 : "+glst2+" result : "+result+" result1
:"+result1+" !</h1>";
//throw new UnsupportedOperationException();
}
and a kawa scheme file:
(module-name "eu.oca.scheme.Vector2D")
(define-simple-class Vector2D ()
...
i made a jar file of eu.oca.scheme.Vector2D put it in library in the
project with add jar/folder in the IDE
all compile now very well and run on a tomcat server
this is of course only for testing... i can call kawa scheme function
from a java netbeans project, that was what i wanted.
well ok your right i imported the class, but for netbeans i was forced
to put the kawa generated classes in a package ,i can not import in the
project a simple class with no source code .
Le 25/09/2015 17:14, Per Bothner a écrit :
>
>
> On 09/25/2015 06:10 AM, Damien Mattei wrote:
>> great !
>>
>> so the scheme modules map to java packages...
>
> No, Scheme modules map to Java *classes*.
>
> This is the "module class" itself. They may be additional
> classes (ones defined by define-class/define-simple-class,
> and "frame" classes used for closures). This are all in the same
> package.
> The frame classes are member classes or inner classes.
> A define-class is (by default) a member class of the module class;
> a define-simple-class is (by default) a sibling class (unless it has
> same name as the module class, in which case they are combined).
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: packaging classes in kawa
2015-09-25 15:49 ` Damien Mattei
@ 2015-09-25 16:21 ` Per Bothner
0 siblings, 0 replies; 9+ messages in thread
From: Per Bothner @ 2015-09-25 16:21 UTC (permalink / raw)
To: Damien Mattei; +Cc: kawa
On 09/25/2015 08:49 AM, Damien Mattei wrote:
> i do not understand well...
If that is a question, I'm afraid we need something more specific ...
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Approach to add a new language
2015-09-24 19:20 ` Per Bothner
2015-09-25 9:04 ` packaging classes in kawa Damien Mattei
@ 2015-09-26 3:41 ` Germán Arias
1 sibling, 0 replies; 9+ messages in thread
From: Germán Arias @ 2015-09-26 3:41 UTC (permalink / raw)
To: kawa
El jue, 24-09-2015 a las 12:19 -0700, Per Bothner escribió:
>
> On 09/24/2015 11:28 AM, Germán Arias wrote:
> > Hi all, I'm new at Kawa, although I have some experience in scheme, but
> > not in java. I read that Kawa can be used to implement other programming
> > languages in java platform. So I would like hear your suggestions to do
> > this. I'm thinking on implement Objective-C, but I don't know how this
> > works. Parse the objective-C files to generate the corresponding Sheme
> > files is enough? Or is necessary other considerations? Thanks in advance
> > for your help.
>
> Objective-C might be a challenge on the JVM, partly because C is a challenge
> on the JVM. Plus you have to define a mapping from the Objective-C class/object
> model to the Java model.
>
> Perhaps you could implement a subset of Objective-C - but why?
>
> I wouldn't use Scheme as an intermediate language (though one could).
> One problem is that makes it hard to get line number information correct.
> Better (and faster) to parse Objective-C and generate the Expression
> objects that Kawa uses.
Thanks for your advice.
P.S. After trying again, I'm able to compile an Objective-C runtime to
android. So, I will be able to compile directly Objective-C on
android :)
Thanks
Germán
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-09-26 3:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-24 18:29 Approach to add a new language Germán Arias
2015-09-24 19:20 ` Per Bothner
2015-09-25 9:04 ` packaging classes in kawa Damien Mattei
2015-09-25 9:09 ` Damien Mattei
[not found] ` <CAE4XeMCHZVDNEMeHXbBHvsgtUXTTzqknZxuTyWp0og8BWuC_mQ@mail.gmail.com>
2015-09-25 13:10 ` Damien Mattei
2015-09-25 15:15 ` Per Bothner
2015-09-25 15:49 ` Damien Mattei
2015-09-25 16:21 ` Per Bothner
2015-09-26 3:41 ` Approach to add a new language Germán Arias
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).