User loginNavigation |
LtU ForumA new PL for embedded applicationsI would like to discuss with you my ideas on new programming language for embedded applications, denoted further as e#. Here I post only the core concept, more details can be found on this link e# is a tool language that should be suitable for all kind of embedded-related development activities, starting from defining the device architecture and its instruction set, documenting device specifics and finishing with programming the device with a developed application. Instead of allowing the developer to write an arbitrary language constructions and pushing the compiler to made an executable out of it, e# should let a developer (a device vendor) to express the device resources, capabilities and constraints in the language terms. These capabilities and constraints than are applied to the application sources, simulation model and executable image. If any of the constraints are violated the e# builder would produce error, either compilation, simulation or code generation time. By hutorny at 2006-08-28 16:59 | LtU Forum | login or register to post comments | other blogs | 6810 reads
Ruby: Prelude - a Haskell-like functional libraryFrom http://rubyforge.org/forum/forum.php?forum_id=8551: "APP Design, Inc. released a pre-alpha code set for the Prelude project. The goal is to enable Ruby programmers to use higher-order functions, monads, infinite lists, and other Haskell features. The project is released under GPL, community participation is more than welcome." By cathper at 2006-08-27 23:12 | LtU Forum | login or register to post comments | other blogs | 6223 reads
Implementing arraysI got to thinking that it would be cool if using a language's builtin tools you could create its array type -- without using its array type. Most language's I've seen have some builtin concept of an array or list. And although some languages give a 'definition' of what a list is -- that defining code won't actually run through the interpreter. I came up with the following C++ implementation that manages to implement an array type without actually using arrays. Before you cry that it depends on the class layout which isn't guarunteed -- it is when a class is a POD, and in this case the element is public so it is, and even if it wasn't, it's a defacto standard that things are layed out this way and projects like boost.python depend on it, and the point of the example is to show that a language can do it (even if the language is "C++ with small tweak").
template<class T, int n>
class Array : public Array<T, n-1>
{
public:
T& operator[](int i);
T tail;
};
template<class T, int n>
T& Array<T, n>::operator[](int i)
{
// Should be able to just use line below
// but some compilers (GCC 3.4) are stupid
// return *(&(Array<T, 1>::mem) + i);
int& x = Array<T, 1>::tail;
return *(&x + i);
}
int main(int argc, char *argv[])
{
Array<int, 5> x;
cout << sizeof(Array<int, 5>) << endl; // 20 as expected
x[0] = 9;
x[1] = 8;
x[2] = 4;
x[3] = 2;
x[4] = 5;
// Prints correctly
cout << x[0] << x[1] << x[2] << x[3] << x[4] << endl;
return 0;
}
How often do you see recursive inheritance? *grin* The whole EnchiladaThe concatenative language Enchilada only defines two types: - Expressions that are sequences of operators and lists. (operators are primitive expressions) One interesting result is that there is no need for an additional integer type. I've recently started a blog to explain some of the details. I'm pretty sure that I've hit something extra-ordinary but I leave it to Lambda the Ultimate to decide. Feedback is much appreciated! Multi-Stage LanguagesFrom the Meta O'Caml tutorial.
Ignoring O'Caml for now, I have tried with the design of several languages to syntactically distinguish between multiple stages (like C++ does with its template system and macro system), and now I have been asking myself the fundamental question: is that really a good idea? If a language is pure (or at least side-effects are contained within some construct like monads) can the compiler not simply choose to apply as many stages as desired, using only partial evaluation? The reason I ask the question is that if I do something like create a subset of the language with a different notation, it just obfuscates things. It seems it would be much easier to provide metaprogramming primitives, and let the compiler's partial evaluation phase try to work out what it can, and do the rest at run-time. This may even solve some thorny type-system problems. So to sum up: my hypothesis is that I should let people write code, as if types are a first class citizen. The partial-evaluation phase will pre-execute what it can. Any non-resolved type expressions will be evaluated at run-time. Any thoughts on the subject would be welcome. Lua error in Iseries (AS400)Hello all ! I will try this way with a error on a Iseries (AS/400) Is this an error in LUA or ...? ¬string "Lua ML (1):line 83:/aXes/de/lua/sidebar.html"|:4: unexpected Hope you give me an answer ! Lars unchecked exceptions are like runtime type checking?I've been having a running discussion with a coworker of mine. He's a big fan of Ruby, while I find its runtime type checking worrisome. His recent response to my concerns about runtime type checking is that in the Java arena people are pushing using unchecked (runtime) exceptions, and that unchecked exceptions are just as unsafe as runtime type checking. In a way I can see his argument, because in Ruby if you misspell a method name it will throw a method not found error, so you could look at Ruby's runtime type checking as simply a source of unchecked exceptions. But I have this sense that it's not quite that simple and can't put my finger on why. "Language Oriented Programming" Meta Programming System(I'm not affiliated with them in any way.) The Meta Programming System from JetBrains: "MPS is an implementation of Language Oriented Programming, whose goal is to make defining languages as natural and easy as defining classes and methods is today. The purpose is to "raise the level of abstraction", which has been a major goal of programming since the first assembly language was born. MPS uses a variety of techniques, especially generative programming, to achieve this. With the freedom to program at a higher level, programmers can increase productivity, reduce errors, and adapt to changes more quickly. The MPS project is still currently in the research phase, and could benefit greatly from open review and comments from anyone interested." I dunno if this is snake-oil, but I've heard good things about the other tools they have released (IntelliJ, Resharper). what are the differences between erlang process and pthread threads?hello, i'd like to find out about the differences between erlang processes and pthreads threads -- not in terms of the use of them but in what they actually are -- what the process and thread consists of -- how processes and threads differ and what those differences mean/amount to. i know an erlang process is much more economical (probably in both memory and cpu use) than a thread -- what is it that threads have and processes don't? stacks? each thread has a stack of it's own i think; do processes not? -- those are the kind of differences i'd like to find out about -- where can i read about this kind of thing? i notice there's a c project called "Protothreads: lightweight, stackless threads in C" ( http://www.sics.se/~adam/pt/index.html ) -- how similar to a process is one of these protothreads do you think (if you happen to know anything about protothreads)? any info on this would be great. thanks, ben. generating interpreters, IDEs, etc., from simple specifications?I've been wondering about this for a while, google and LtU archives didn't bring up anything: My understanding is that BNF (or EBNF) as it is usually used by parser-generators is not strong enough for this task because: Regarding the first problem, I found the following from CTM (p. 641, last paragraph) interesting: Doesn't this mean that we can describe a general grammar which is good not only for parsing, but also for extracting a simple, clean AST (let's say we accept the slow speed for the sake of building an easy language-prototyping system). Regarding the semantics of a language: why couldn't we use some sort of operational semantics, the way they are described in Pierce's TAPL (actually PVR has has an SOS in CTM...lol :) ) In other words, given the following: (I understand that many existing languages are not easy to define using TAPL type rules...perhaps a system such as this, with all its benefits, will encourage non-expert language creators to put more thought into semantics) |
Browse archives
Active forum topics |
Recent comments
10 weeks 4 days ago
10 weeks 4 days ago
10 weeks 4 days ago
10 weeks 5 days ago
11 weeks 1 day ago
11 weeks 1 day ago
11 weeks 2 days ago
11 weeks 3 days ago
11 weeks 3 days ago
11 weeks 3 days ago