Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

High-level system language that compiles to c?

I'm looking for a higher-level system language, if possible, suitable for formal verification, that compiles to standard C, so that it can be run cross-platform with (relatively) low overhead.

The two most promising such languages I've stumbled during the past few days are:

  1. BitC - While the design goals of this language match my needs (it even supports the functional paradigm), it is in very unstable state, the documentation is out of date, and, generally, it seems like a very long shot for a real-world project.

  2. Lisaac - It supports Design-by-contract, which is very cool and has a relatively low performance overhead. However the website is dead, there hasn't been a new release since '08 and generally it seems the language is dead.

I'd also like to note that it's not meant for a real-time system, so a GC or, generally, non-determinism (in the real-time sense), is not an issue.

The project involves mainly audio processing, though it has to be cross-platform.

I assume someone would point me to the obvious answer - "plain ol' C". While it is truly cross-platform and very effective, the code quantity would probably be greater.

EDIT: I should clarify that I mean cross-platform AND cross-architecture. That is why I consider only languages, compiled to C in the first place, but if you can point me to another example, I'd be grateful :)

like image 650
K.Steff Avatar asked Mar 20 '12 02:03

K.Steff


People also ask

What is high level language in C?

A high-level language (HLL) is a programming language such as C, FORTRAN, or Pascal that enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high-level because they are closer to human languages and further from machine languages.

Which high-level languages are use compiler?

1. Compiler : The language processor that reads the complete source program written in high-level language as a whole in one go and translates it into an equivalent program in machine language is called a Compiler. Example: C, C++, C#, Java.

Is C C++ a high level language?

C++ is still considered a high-level language, but with the appearance of newer languages (Java, C#, Ruby etc...), C++ is beginning to be grouped with lower level languages like C.

Is C high-level or low-level language?

C and C++ are now considered low-level languages because they have no automatic memory management.


2 Answers

I think you may become interested in ATS. It compiles to C (actually it expresses and explains many C idioms and patterns from a formal type-theoretic perspective, it has even been proposed to prepare a book of sorts to show this -- if only we had more time...).

The project involves mainly audio processing, though it has to be cross-platform.

I don't know much about audio processing, I've been mainly doing some computer graphics stuff (mostly the basic things, just to try it out).

Also, I am not sure if ATS works on Windows (never tried that).

(Disclaimer: I've been working with ATS for some time. It is bulky and large language, and sometimes hard to use, but I very much liked the quality of programs I've been able to produce with it, for instance, see TEST subdirectory in GLES2 bindings for some realistic programs)

like image 149
Artyom Shalkhakov Avatar answered Sep 18 '22 11:09

Artyom Shalkhakov


The following doesn't strictly adhere to the requirements but I'd like to mention it anyway and it is too long for a comment:

Pypy's RPython can be translated to C. Here's a nice talk about it. It's been used to implement Smalltalk, JavaScript, Io, Scheme, Gameboy (with various degree of completeness), but you can write standalone programs in it. It is known mainly for its implementation of Python language that runs on Intel x86 (IA-32) and x86_64 platforms.

The translation process requires a capable C compiler. The toolchain provides means to infer various things about the code (used by the translation process itself) that you might repurpose for formal verification.

If you know both Python and C you could use cython that translates Python-like syntax to C. It is used to write CPython extensions.

like image 39
jfs Avatar answered Sep 19 '22 11:09

jfs