User loginNavigation |
LtU Forumonline literature on CPL?Hello all! Is there available online (and free) literature on CPL? More specifically, I am interested in Thank you in advance, Lexical structure of scripting languageshi all, so you are bored and want to write a new language. what do you do at first? plan a look and feel. well, different people come from different backgrounds and they don't like the same look and feel. but then, it basically means you write a lexer, a parser, and then finally the interpreter. too much work. and it's not reusable by any other bored programmer. it's fun doing it again, of course. :) I was thinking, what about having a rough lexical standard for interpreted languages? the point is that with clear specification everyone can write a lexer/parser and then extend it. hopefully, the base will already be there. of course, different languages are different...
things like these... the problem with interpreted language is that they are very concise, in my humble opinion, too concise. of course, diving any deeper will cause so much difference in opinions that I should probably stop here. High-Level Nondeterministic Abstractions in C++High-Level Nondeterministic Abstractions in C++, L. Michel, A. See, and P. Van Hentenryck.
Although implementing continuations in C(++) with setjmp/longjmp is not new, this paper shows a nice application of the technique. By zayenz at 2006-07-04 08:03 | LtU Forum | login or register to post comments | other blogs | 6977 reads
2006 ICFP Programming Contest registration opensLanguage lovers: Registration is now open for the 9th Annual ICFP Programming Contest! The contest, associated with the International Conference on Functional Programming, will be held on the weekend of July 21-24. The contest task will be released at noon EDT on Friday, and entries will be accepted until noon EDT on Monday. Registration is free and open to all. Teams may participate from any location, and may use any programming language(s). Last year, 360 participants formed 161 teams from 26 countries. Prize money totaling $1750 US will be awarded to help defray the costs of travel to the conference for the winners and for small cash prizes. In addition, the winners of the contest will receive bragging rights for the programming language of their choice. This makes the contest a popular avenue for demonstrating the superiority of a favorite language, or for exercising an experimental tool. Though the specifics are secret until the contest begins, we promise that this year's task will be very different from past competitions. This year's theme is "computational archaeolinguistics." Stay tuned for more information as the contest approaches! - 2006 Contest Organizers A new implementation of recursive-descent parsing?It is well known that the classic way to model a recursive-descent parser is to write (or automatically produce) a set of mutually-recursive functions either by writing procedures or combining parser modules using a DSL (like in Boost::Spirit) or using templates/generics (for those languages that support such a concept). All the different types of implementations work in a similar manner: each procedure invokes one or more procedures. This approach has some drawbacks:
While trying to approach the issue of RD parsers from a different perspective, I think I have found an implementation which solves some of the problems mentioned above. I hope I am not repeating someone else's work (a brief search over the internet found no similar approaches). The idea is that instead of the input data travelling down the tree of parsers, each parser processes the current input and then leaves a continuation on a stack. The main parse engine pops the continuation off that stack and executes it; the new continuation puts another state on the stack etc. Thus an RD parser becomes a sort of state machine. Generally an RD parser consists of the following operations:
The traditional approach handles these operations in the following ways:
For example (in pseudo-Java):
class sequence_parser implements parser {
list parsers;
iterator parse(iterator input) {
foreach(p, parser) {
input = p.parse(input);
}
return input;
}
}
class choice_parser implements parser {
list parsers;
iterator parse(iterator input) {
foreach(p, parser) {
iterator output = p.parse(input);
if (output != null) return output;
}
return null;
}
}
class loop_parser implements parser {
parser other;
iterator parse(iterator input) {
input = other.parse(input);
return parse(input);
}
}
The new approach handles these tasks differently. The approach uses the following context for parsing:
Parsing operations are handled like this:
For example:
class sequence_parser implements parser {
parser sequence_next;
parser this_parser;
iterator parse(context c) {
c.sequence_stack.push(sequence_next);
return this_parser.parse(c);
}
}
class choice_parser implements parser {
parser choice_next;
parser this_parser;
iterator parse(context c) {
c.save();
c.choice_stack.push(choice_next);
return this_parser.parse(c);
}
}
class loop_parser implements parser {
parser this_parser;
iterator parse(iterator input) {
c.sequence_stack.push(this);
return this_parser.parse(c);
}
}
The parsing algorithm then becomes a very simple loop:
void parse(context c) {
while (true) {
parser = c.sequence_stack.pop();
if (parser != null) {
iterator output = parser.parse(c);
if (output == null) {
parser = c.choice_stack.pop();
if (parser) {
c.restore();
c.sequence_stack.push(parser);
}
else throw parse_exception();
}
}
else (if c.input_exhausted()) {
return;
else {
throw parse_exception();
}
}
}
The above does the following:
This approach solves some of the problems of the traditional approach in the following ways:
Amusing questionTake a look at this crooked timber thread. How well does this phenomenon apply to our field? Why did you decide PLT is cool? Was it because of the writing from a specific school of thought (let's include papers as well as books)? Did they give you the right impression of the field? Introduction to Concurrent Programming with Stackless PythonGrant Olson has a writeup of concurrent programming with Stackless Python. There is a great deal of actual code in the article. Obviously concurrent programming can't be mentioned without mentioning Mozart-Oz (which recently went into version 1.3.2), Erlang and AliceML. Frankly, despite my attempts, I don't understand Haskell's FRP enough to know if it fits here as well. (while searching archives of LtU for previous interesting mentions of concurrent programming, I came accross a post about SuperGlue...note the first message containing PVR's mention of FRP) Oxymoronic? "Safety-critical development guidelines for real-time Java"Came across the PERC Raven Java PDF advertising stuff while looking for other real-time GC implementations. I'm not sure I want Java near my nuclear reactors, but food for thought never-the-less. (Scroll down to the second page of the PDF to see the guidelines.) Article: Exploring Cocoa with F-ScriptI've made available a new article that shows how it is possible to interactively explore and script Objective-C objects on Mac OS X, using F-Script, an open source scripting language. The article describes the object browser and other interactive modules tailored for the exploration of objects at runtime. The article is at http://www.fscript.org/documentation/ExploringCocoaWithFScript/index.htm Nanopass Compiler FrameworkWhile not directly related to PL theory, I consider compiler construction a close relative. This set of papers describes Indiana University's compiler coursework. The key to these papers is "very small source-to-source transformations", remaining executable between passes for pedagogy and verification. Scheme is used as the source and target language because its s-expression syntax requires no 'marshaling' to and from human-readable syntax and AST structures. Later stages of the compiler include annotations directly in the source as quoted, unevaluated lists. There is also a Summer Scheme Workshop (with complete compiler code) demonstrating some of these ideas. If anyone finds code for the Nanopass or Micropass compiler, please let me know. I'm interested in studying them as well.
[1] Compiler Construction Using Scheme Hilsdale, Ashley, Dybvig, and Friedman. Ancillary: |
Browse archives
Active forum topics |
Recent comments
8 weeks 1 day ago
8 weeks 1 day ago
8 weeks 2 days ago
8 weeks 2 days ago
8 weeks 6 days ago
8 weeks 6 days ago
9 weeks 7 hours ago
9 weeks 11 hours ago
9 weeks 12 hours ago
9 weeks 12 hours ago