Re: [go-nuts] C++ 11 to Golang convertor

2019-01-07 Thread Bakul Shah
On Sun, 06 Jan 2019 17:01:20 -0500 "Eric S. Raymond" wrote: > > A simple, possibly correct LR parser for C11 > > http://gallium.inria.fr/~fpottier/publis/jourdan-fpottier-2016.pdf This paper says its lexer+parser is about 1000 lines, which doesn't include the preprocessor. For comparison, subc (a

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-07 Thread Jan Mercl
On Sun, Jan 6, 2019 at 11:01 PM Eric S. Raymond wrote: > I would like to learn more about that strategy, if possible. > A simple, possibly correct LR parser for C11 > > http://gallium.inria.fr/~fpottier/publis/jourdan-fpottier-2016.pdf Thanks. I probably caused a small misunderstanding. By stra

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-06 Thread Eric S. Raymond
Jan Mercl <0xj...@gmail.com>: > I would like to learn more about that strategy, if possible. Diggingpaper by two French guys on how astoundingly perverse parsing C can get...Perry Metzger pointed me at it... Ah, here it is: A simple, possibly correct LR parser for C11 http://gallium.inria.f

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-06 Thread Jan Mercl
I would like to learn more about that strategy, if possible. On Sun, Jan 6, 2019, 22:38 Eric S. Raymond wrote: > > Having studied the problem, the most serious blocker is an ambiguity > between > typedefs and variable names in some contexts. And there exists a good > strategy for resolving those

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-06 Thread Eric S. Raymond
Jan Mercl <0xj...@gmail.com>: > I'm afraid that a lot, if not most of existing C code, even when simple, > clean and preprocessor-abuse-free, cannot be parsed before preprocessing. Having studied the problem, the most serious blocker is an ambiguity between typedefs and variable names in some cont

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-06 Thread Jan Mercl
On Sun, Jan 6, 2019 at 2:27 PM Eric S. Raymond wrote: > But for both of them our intended strategy is *not* to preprocess. > Instead, we're willing to accept that some abuses of the preprocessor > need to be punted to a human, but treat other uses as part of the > parse tree. I'm afraid that a l

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-06 Thread Eric S. Raymond
andrey mirtchovski : > > It would sure help if Go had sum types. Has there been any discussion > > of adding these? > > one of many, but has links to others: > https://github.com/golang/go/issues/19412 Thanks. My experience report on the reposurgeon port will point at yet another use case for s

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-06 Thread andrey mirtchovski
> It would sure help if Go had sum types. Has there been any discussion > of adding these? one of many, but has links to others: https://github.com/golang/go/issues/19412 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this g

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-06 Thread Eric S. Raymond
Andy Balholm : > A good translation from C to Go needs to look as much like the original, > un-preprocessed C source as possible. But a powerful translation tool will > probably need to preprocess, parse, and typecheck the code, while keeping > track of the source location that everything corres

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-05 Thread Andy Balholm
Yes, the preprocessor… The preprocessor is one of the biggest obstacles to readable C-to-Go translation. rsc/c2go largely ignores preprocessor directives other than #include—and it doesn’t include a translation of the headers at the top of every output file. But most C programs are a lot more d

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-03 Thread Ian Denhardt
Quoting Andy Balholm (2019-01-03 18:34:35) >It's at [1]https://github.com/rsc/c2go. It might be a good starting >place, but there is one significant difference in approach from what >Eric is proposing. Russ incorporated all of the manual cleanup into the >tool (or config files) as s

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-03 Thread Andy Balholm
It’s at https://github.com/rsc/c2go . It might be a good starting place, but there is one significant difference in approach from what Eric is proposing. Russ incorporated all of the manual cleanup into the tool (or config files) as special cases, rather than leaving

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-03 Thread Andy Balholm
You don’t use CGo; you just translate all the libraries you depend on as well. :-P But you’re definitely right about pthreads; that would be a nightmare. Andy > On Jan 3, 2019, at 10:01 AM, Robert Engels wrote: > > I am pretty sure the other task is impossible, unless the generated code used

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-03 Thread Robert Engels
I am pretty sure the other task is impossible, unless the generated code used CGo for all of its work. It gets really difficult for multithreaded apps, pthread does not translate to Go routines, no TLS, etc. I think correcting the converted Go would be more daunting that just rewriting it in

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-03 Thread Andy Balholm
I’ve been working on a tool (called leaven) to convert LLVM IR (intermediate representation) to Go. So you can compile C to LLVM with clang, and then convert the result to Go. It’s actually pretty easy, because LLVM instructions are such simple operations. But it’s not very readable; given this:

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-02 Thread Ian Lance Taylor
On Wed, Jan 2, 2019 at 7:37 PM wrote: > > I have C++ 11 source files which I need to convert to Go language code > Is there any converter tool for this. > I google quite a few tools, none seems powerful and complete enough to do the > job.for me. C++ 11 is a much more complex language than Go.

[go-nuts] C++ 11 to Golang convertor

2019-01-02 Thread aureallm2170
Hello All I have C++ 11 source files which I need to convert to Go language code Is there any converter tool for this. I google quite a few tools, none seems powerful and complete enough to do the job.for me. Please help Thanks Abhishek -- You received this message because you are subscribed