А для полноты картины, чтобы было понятно куда шагает Компонентный Паскаль или куда он может шагнуть, думаю, небезынтересны и следующие письма по этой теме.
Chris Molozian писал(а):
Hi Oleg,
It's very interesting to hear from another Oberon-2 user, you're a rare bunch these days... thanks for reaching out to me.
At Bath University during my Masters one of my lecturers was a huge Oberon-2 fan, she introduced me to the language and piqued my interest enough to combine my passion with building programming languages & compilers to work on a compiler for Oberon-2.
I built the compiler to generate code for a subset of the language (although the lexer, parser and AST represented the full Oberon-2 semantics). I wrote the compiler in the
D programming language using the LLVM-D bindings and re2c for the parser generator.
One of the major weaknesses of the project work, was that I didn't have time to write a language runtime for the compiler (i.e. libob2 like you'd find with libc). As a result, I cheated and made the compiler aware of libc and statically linked that to the generated executable, not ideal but I had a limited amount of time (and lots to learn about writing a language runtime...).
Unfortunately, UK universities don't share much information publicly about the projects that their students work on and usually the research is considered intellectual property of the university. In any case, since the project's completion I've had a series of laptops stolen, one of which had the source code for the compiler.
I'd considered resurrecting the project idea, and writing the compiler again from scratch (I've learnt a lot since then) but I wasn't sure anyone would be interested in an Oberon-2 compiler. With your email to me showing interest, it makes me think that it might be worth considering the idea again.
If I were to help write a compiler for Oberon-2 again I'd probably use the following technologies:
Write it in the D programming language (D code can be compiled on Windows, Linux and Mac OSX).
Use the Pegged parser generator for D.
Use the LLVM for the compiler backend (it continues to get more awesome as a code generator).
Use a build tool like Jam (or Waf) to handle cross-platform builds.
Let me know if you (and other people at the Oberon Club) would *definitely* be interested on working on this idea and I can setup a Git repository (on GitHub). I'm very busy at the moment in my new job (I work for
Basho Technologies) and would not be able to be the project manager for the code repository but I'd certainly be very happy to contribute code.
Cheers,
Chris
А вот что пишут по этому поводу люди, которые вполне ощутимо могли бы повлиять на ситуацию с языком КП.
Marc Frei писал(а):
Dear Oleg,
a LLVM backend for Oberon would certainly be a very interesting project but unfortunately we are not able to contribute any resources -- neither work nor funding.
>> did you use any automatic front-end builder, and have you CP notation
>> for it? (in EBNF, for example)
The frontend of our own compiler is handwritten. Its design is based on Régis Crelier's OP2 (
ftp://ftp.inf.ethz.ch/pub/publications/ ... xx/125.pdf). If you would like to reuse parts of our code for your project, we would be willing to license it under the simplified BSD license (
http://opensource.org/licenses/bsd-license.php).
We are sorry if this reply is disappointing but we are a small company and our current focus lies on other projects.
Kind regards,
Marc
K John Gough писал(а):
Hi Oleg
Thanks for the email.
First, yes I am familiar with LLVM, it is used in another project that I am currently working on. In principle it would be possible to construct a back-end for GPCP using LLVM. This would be relatively simple given that GPCP was already designed to support multiple backends. Originally I had expected to connect GPCP to the JVM, the .NET framework, and the native-code "D-Code" backends of my 1990s Modula-2 compilers. The main obstacle was the construction of the runtime and a quality garbage collector. LLVM currently supports accurate garbage collection, so that problem is solved.
I am happy to plan to do this. However, I should warn you that I am unable to give it high priority, as I have several other projects that I am already committed to.
I will post more information when I have had time to produce a project plan.
Regards
John
У меня самого есть некоторые идеи для мультиплатформенного компилятора КП. Например, сделать поддержку прямого включения сишных интерфейсов *.h в свои проекты на Обероне. У языка Оберон (и, как видим, у языка D) сейчас наблюдается проблема с использованием готовых сишных библиотек — даже если к ним есть готовые биндинги, они устаревают с выходом новых версий библиотек. Чтобы не гнаться за Си и не актуализировать постоянно биндинги, чтобы не отставать от Си, чтобы не использовать полуавтоматических утилит типа H2O и иметь возможность всегда воспользоваться готовыми наработками на Си, очень хорошо бы применять прямое включение *.h в свои проекты (конечно же с ослаблением строгости безопасности и типизации при обращении к таким "модулям", в духе Си). На эту мысль меня навела многочасовая работа над
биндингами к SDL.