User loginNavigation |
LtU ForumOwl: A parser generator for visibly pushdown languages.Owl is a parser generator which targets the class of visibly pushdown languages. It is:
The restriction to visibly pushdown languages imposes restrictions on recursion. Rules can only refer to later rules, not earlier ones, and all recursion must be guarded inside guard brackets. [ begin ... end ] The symbols just inside the brackets are the begin and end tokens of the guard bracket. Begin and end tokens can't appear anywhere else in the grammar except as other begin and end tokens. This is what guarantees the language is visibly pushdown: all recursion is explicitly delineated by special symbols. Note: I am not the Owl author, but I found it to be a useful tool for my own projects. I play around with toy programming languages as a hobby and I am not well-versed on automata theory. I am posting here because I would be interested to know what your thoughts are about the class of visibly pushdown languages, specifically the constraints it imposes on recursion, how that compares to recursive descent, and any pointers to variations or similar approaches that you know of. By helltone at 2020-05-02 08:21 | LtU Forum | login or register to post comments | other blogs | 4307 reads
Why is there no widely accepted progress for 50 years?From machine code to assembly and from that to APL, LISP, Algol, Prolog, SQL etc there is a pretty big jump in productivity and almost no one uses machine code or assembly anymore, however it appears there's been almost not progress in languages for 50 years. Why is that? Are these the best possible languages? What is stopping the creation of languages that are regarded by everyone as a definite improvement over the current ones? Functional Constructors in Theme-D
I redesigned the constructors in Theme-D version 2.0.0, see [1].
The design is inspired by the OCaml object system.
Constructors are special procedures used to create instances (objects)
of classes. They are not defined like other procedures but
Theme-D creates them using the
construct statement in a
class and field initializers in a class. The translator-generated
default constructor is sufficient in many cases. For example, consider
the class <complex> defined in the standard library:
(define-class <complex>
(attributes immutable equal-by-value)
(inheritance-access hidden)
(fields
(re <real> public hidden)
(im <real> public hidden))
(zero (make <complex> 0.0 0.0)))
The translator-generated default constructor takes two real arguments
and sets the first to the field re and the second to the field
im.
The programs
(define-class <widget>
(fields
(str-id <string> public module)))
(define-class <window>
(superclass <widget>)
(construct ((str-id1 <string>) (i-x11 <integer>) (i-y11 <integer>)
(i-x21 <integer>) (i-y21 <integer>))
(str-id1))
(fields
(i-x1 <integer> public module i-x11)
(i-y1 <integer> public module i-y11)
(i-x2 <integer> public module i-x21)
(i-y2 <integer> public module i-y21)
(i-width <integer> public module (+ (- i-x21 i-x11) 1))
(i-height <integer> public module (+ (- i-y21 i-y11) 1))))
The constructor of class <window> passes the first argument
str-id1 to the constructor of its superclass
<widget>. The constructors also initialize the fields using their
arguments. Note that the field initializers may contain more complex
expressions than just copying an argument variable.
Here is the second example:
(define-class <widget>
(construct ((str-id1 <string>)) () (nonpure))
(fields
(str-id <string> public module
(begin
(console-display "new widget: ")
(console-display-line str-id1)
str-id1))))
(define-class <window>
(superclass <widget>)
(construct ((str-id1 <string>) (i-x11 <integer>) (i-y11 <integer>)
(i-x21 <integer>) (i-y21 <integer>))
(str-id1) (nonpure))
(fields
(i-x1 <integer> public module i-x11)
(i-y1 <integer> public module i-y11)
(i-x2 <integer> public module i-x21)
(i-y2 <integer> public module i-y21)
(i-width <integer> public module (+ (- i-x21 i-x11) 1))
(i-height <integer> public module (+ (- i-y21 i-y11) 1))))
Here we log the calls to the constructor of <widget> to the
console. Note that we have to declare the constructors as
nonpure if they have side effects.
[1] Theme-D Homepage By Tommi Höynälänmaa at 2020-03-08 16:58 | LtU Forum | login or register to post comments | other blogs | 3899 reads
Deterministic ConcurrencyToward a deterministic treatment of concurrency for the general case. Various desired forms of reasonablenessA small study in the vagaries of Rgular types in C++. How can we get better statically typed assurances around the nuances of such concepts? Which languages help the most? Things like Rust or ATS come to mind. Bjarne Stroustrup interview on Youtube.Lex Fridman just interviewed Bjarne Stroustrup on youtube. It's long; a bit over an hour and a half. But they're talking extensively about C++ and its origins and evolutions and guiding principles. By Ray Dillinger at 2019-11-08 23:31 | LtU Forum | login or register to post comments | other blogs | 5304 reads
Type Mapping in Source-To-Source TranslationI'm in the middle of writing an Object-Pascal-to-Java translator. One interesting aspect is the mapping between source and target types. Is anybody aware of literature about this topic, books, papers, etc.? I would be interested in things like rules for "widening" a target type over the source type; constraints that must hold on operations applied in the target language so that the result complies with the result in the source language; maybe a formalism where you could even show (prove) that, given some sets of types and operations; etc. I do not aim to set things up this way, but would enjoy reading some theoretical material about what I'm doing. Is there serious research in the area of source translation, anyway? Histogram: You have to know the past to understand the present by Tomas PetricekHistogram: You have to know the past to understand the present by Tomas Petricek, University of Kent
RopeThis is my very first post on this site. Also this is my first post regarding my new PL idea: Rope First, an introduction to me (in a hopefully non-narcissistic way): I have no experience or education designing programming languages.
I get it, and I agree with it for the most part; why waste your time doing what has already been done? What progress would we make if everyone started from how to make fire and tried making it to the moon? But there is something that I don't agree with. (Not with Newton, but with a secondary application) Should we all only blaze trails where a previous trailblazer left off? My personal experience has taught me that, if you disagree, then you'll learn more and, rarely, discover something amazing. It is with that mentality that I want to introduce "Rope." Second, an introduction to ROPE:
That's all I got for now. But I'm sure I'll come up with more. The lofty goal behind the "language to create languages" philosophy is that, at the start, everyone tries to make their PL perfectly suited for its purpose. But as we've seen, languages keep expanding and descendants get spawned as a result of either success or failure. So if we had to do it all over again, wouldn't we want a language that intended to have descendants. Wouldn't it have been nice to have a language that lived for its children? That's the idea I want to explore. Oh and as a final thought. The origin of the name is this: NDArray/multi-columnar with efficient CRUD operations?I'm in the hunt for material or implementations of NDArray and/or columnar structures with not-bad support for CRUD operations (insert-update-delete) that could work in-memory. I'm aware of kdb+ but my understanding is only for big append-only loads then calculations on it. Currently, I have for my own little relational lang (http://tablam.org) several structures that backed the relations (BTreeMaps - Vectors - Table - Scalars). The main is a table: https://bitbucket.org/tablam/tablam/src/41b3b0676d6062031998af48b683f8f0062bf279/core/src/types.rs#lines-221 and this is ok. But wonder what other options I could explore. (The allure for me in use just a NDArray-like container is that I can reduce my implementations to just 2 BtreeMaps - NDArray) By mamcx at 2019-07-31 15:58 | LtU Forum | login or register to post comments | other blogs | 3495 reads
|
Browse archives
Active forum topics |
Recent comments
1 day 3 hours ago
1 day 23 hours ago
3 days 4 hours ago
3 days 4 hours ago
1 week 1 day ago
1 week 1 day ago
1 week 1 day ago
4 weeks 1 day ago
5 weeks 6 hours ago
5 weeks 12 hours ago