Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #562 > unrolled thread
| Started by | compilers@is-not-my.name |
|---|---|
| First post | 2012-04-17 21:28 +0000 |
| Last post | 2012-06-06 16:52 +0000 |
| Articles | 20 on this page of 53 — 20 participants |
Back to article view | Back to comp.compilers
Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-17 21:28 +0000
Re: Good practical language and OS agnostic text? Philip Herron <redbrain@gcc.gnu.org> - 2012-04-18 14:25 +0100
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-19 16:32 +0000
Re: Good practical language and OS agnostic text? arnold@skeeve.com (Aharon Robbins) - 2012-04-20 03:58 +0000
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-22 10:10 +0000
Re: Good practical language and OS agnostic text? "BartC" <bc@freeuk.com> - 2012-04-20 09:45 +0100
Re: Good practical language and OS agnostic text? "Jonathan Thornburg" <jthorn@astro.indiana.edu> - 2012-04-21 15:04 +0000
Re: Good practical language and OS agnostic text? BGB <cr88192@hotmail.com> - 2012-04-18 08:39 -0700
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-19 17:32 +0000
Re: Good practical language and OS agnostic text? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2012-04-18 18:24 +0200
Re: Good practical language and OS agnostic text? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2012-04-19 13:53 +0200
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-21 03:07 +0000
Re: Good practical language and OS agnostic text? "BartC" <bc@freeuk.com> - 2012-04-21 12:01 +0100
Re: code quality, was Good practical language and OS agnostic text? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2012-04-22 12:41 +0200
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-19 11:31 +0000
Re: Good practical language and OS agnostic text? "Jonathan Thornburg" <jthorn@astro.indiana.edu> - 2012-04-20 16:19 +0000
Re: Good practical language and OS agnostic text? "Derek M. Jones" <derek@knosof.co.uk> - 2012-04-18 18:16 +0100
Re: Good practical language and OS agnostic text? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-04-18 22:43 +0000
Re: Good practical language and OS agnostic text? BGB <cr88192@hotmail.com> - 2012-04-19 00:05 -0700
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-19 11:31 +0000
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-19 16:32 +0000
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-18 19:30 +0000
Re: Good practical language and OS agnostic text? "BartC" <bc@freeuk.com> - 2012-04-19 18:43 +0100
Re: Good practical language and OS agnostic text? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-04-18 20:29 +0000
Re: Good practical language and OS agnostic text? Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2012-04-19 14:20 +0200
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-19 19:05 +0000
Re: Good practical language and OS agnostic text? Uli Kusterer <ulimakesacompiler@googlemail.com> - 2012-04-21 11:30 +0200
Re: Good practical language and OS agnostic text? Roberto Waltman <usenet@rwaltman.com> - 2012-04-18 22:00 -0400
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-19 11:31 +0000
Re: Good practical language and OS agnostic text? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-04-20 07:02 +0000
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-22 11:10 +0000
Re: Good practical language and OS agnostic text? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-04-22 23:56 +0000
Re: PL/360, was Good practical language and OS agnostic text? ArarghMail204@Arargh.com - 2012-04-24 19:13 -0500
Re: Good practical language and OS agnostic text? Bakul Shah <usenet@bitblocks.com> - 2012-04-18 21:15 -0700
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-20 16:06 +0000
Re: Good practical language and OS agnostic text? torbenm@diku.dk (Torben Ægidius Mogensen) - 2012-04-19 14:58 +0200
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-20 16:06 +0000
Re: Good practical language and OS agnostic text? "Joe Schmo" <askmeforit@myisp.com> - 2012-04-21 02:53 -0600
Re: Writing parsers, was Good practical language and OS agnostic text? Uli Kusterer <ulimakesacompiler@googlemail.com> - 2012-04-22 16:18 +0200
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-23 19:12 +0000
Re: Good practical language and OS agnostic text? Uli Kusterer <ulimakesacompiler@googlemail.com> - 2012-04-21 11:22 +0200
Re: Good practical language and OS agnostic text? BGB <cr88192@hotmail.com> - 2012-04-21 18:58 -0700
Re: writing interpreters, was Good practical language and OS agnostic text? Uli Kusterer <ulimakesacompiler@googlemail.com> - 2012-04-22 12:53 +0200
Re: writing interpreters, was Good practical language and OS agnostic text? BGB <cr88192@hotmail.com> - 2012-04-22 12:29 -0700
Re: generating bytecode, was Good practical language and OS agnostic text? Uli Kusterer <ulimakesacompiler@googlemail.com> - 2012-04-22 13:12 +0200
Re: Recursive descent parsing and optimization, was Good practical language and OS agnostic text? "BartC" <bc@freeuk.com> - 2012-04-22 12:51 +0100
Re: Recursive descent parsing and optimization, was Good practical language and OS agnostic text? "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-04-22 18:18 +0200
Re: Recursive descent parsing and optimization, was Good practical language and OS agnostic text? "Bartc" <bartc@freeuk.com> - 2012-04-23 10:59 +0100
Re: Recursive descent parsing and optimization, was Good practical language and OS agnostic text? BGB <cr88192@hotmail.com> - 2012-04-22 13:45 -0700
Re: Good practical language and OS agnostic text? compilers@is-not-my.name - 2012-04-22 22:11 +0000
Re: Good practical language and OS agnostic text? "BartC" <bc@freeuk.com> - 2012-04-23 18:41 +0100
Re: Good practical language and OS agnostic text? basile@starynkevitch.net - 2012-05-02 22:16 -0700
Re: Good practical language and OS agnostic text? Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> - 2012-06-06 16:52 +0000
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
| From | compilers@is-not-my.name |
|---|---|
| Date | 2012-04-19 16:32 +0000 |
| Message-ID | <12-04-039@comp.compilers> |
| In reply to | #567 |
derek@nospam.knosof.co.uk wrote > I always recommend: > A Retargetable C Compiler: Design and Implementation > by David R. Hanson and Christopher W. Fraser Thanks. > If you are weak on math you might have a problem getting your head > around recursion. I'm sure I don't understand recursion like a mathematician understands it. I think I understand the applied use of it. > If you cannot understand recursion your compiler writing days are > finished. Before they even started, how sad! > > I think of all the compilers were written in the DOS days and there > > were normal guys writing them, not Nobel math prizewinners. Shirley > > In my experience compiler writers are not normal guys, but then I > am a vested interest. You're probably right since the more I look at it the more it seems the 90/10 rule applies. 90% of compilers were written by the same guys. Small group after all. I guess you (plural) have a vested interested in keeping the group small ;-) [Back when I was a grad student, I taught the compilers course required for all CS majors. Some of them even wrote compilers that worked. -John]
[toc] | [prev] | [next] | [standalone]
| From | compilers@is-not-my.name |
|---|---|
| Date | 2012-04-18 19:30 +0000 |
| Message-ID | <12-04-026@comp.compilers> |
| In reply to | #562 |
> [Sorry to burst your bubble, but I knew people writing compilers for > DOS, and they understood parsing theory just fine. Although I agree > that some compiler texts are more readable than others, the math isn't > there to be obscure, it's there because understanding how state > machines and LL and LR work makes writing fast and reliable scanners > and parsers vastly easier. I know you have quite a lot of knowledge on the topic so I will take your word for it. But are you really telling me you learned all the theory before you ever started a compiler project? I need a way to get started and I can't seem to understand the math I have seen so far and I have nobody to talk it over with so I really need something more practical. I realize I won't be an expert on compiler theory or parsing theory or any other kind of theory but I cannot believe the principles can't be generalized enough with some basic non-mathematical explanations to be useful in practice or that if someone did that the results would have no practical value. Eventually theory has to be implemented and the implementation doesn't contain all the theory, so there has to be a way. As we all know, it's not uncommon to implement algorithms that the programmer doesn't (fully) understand in code, he depends on scientists, mathematicians etc. to generalize it enough so it can be implemented usefully. That's what I'm looking for at this point. I'll take somebody else's word on the theory, I would like to see the data structures and understand the algorithms from a practical view and accept the logic behind it is sound. > As far as the language they use for examples, you have to use something. Pseudocode would be more readable for me than what I am finding in modern texts. If you're saying they all use code then I'll revise my request and ask for a text that uses assembly language rather than C or an HLL. > If you can find a copy of Holub's "Compiler Design in C", and the errata > list which is essential due to the incredible number of errors in the > published edition, you might be able to work your way through that. -John] Since there are an incredible number of errors is this really a book a guy like me should be using, even with the errata list? I have no experience with C and I find it unreadable. I get the big picture with C but not the important details. Thank you. [I didn't learn all the theory before I ever started a compiler project, but the compiler I wrote before I knew any theory was pretty putrid. Don't ask for details, it was in about 1970 and I don't remember many of them. Holub's book does require that you understand C, but once you've applied all the errata, it's not bad and quite practical. -John]
[toc] | [prev] | [next] | [standalone]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Date | 2012-04-19 18:43 +0100 |
| Message-ID | <12-04-042@comp.compilers> |
| In reply to | #569 |
<compilers@is-not-my.name> wrote in message news:12-04-026@comp.compilers... >> [Sorry to burst your bubble, but I knew people writing compilers for >> DOS, and they understood parsing theory just fine. Although I agree >I need a way to get started and I can't > seem to understand the math I have seen so far and I have nobody to talk > it over with so I really need something more practical. You don't need any maths to get started. Perhaps that was to do with parsing; just google for "recursive descent parsers", you might find some examples that don't use a curly-brace language. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2012-04-18 20:29 +0000 |
| Message-ID | <12-04-027@comp.compilers> |
| In reply to | #562 |
compilers@is-not-my.name wrote: > Guys, I'm having a bear of a time finding a good practical language > and OS agnostic text on writing a compiler. I'm weak in math and not > interested in the theoretical details. I want to understand the hows > and whys of compiler writing. Everything I've found is either > gobbledygook equations or "let's use C/C++/Java on UNIX" or things > that are so trivial and focused they don't explain general cases and > can't be extended to anything useful. My favorite understandable compiler book is the LCC book: http://www.amazon.com/Retargetable-Compiler-Design-Implementation/dp/0805316701 You might be right that all books are one (or more) of those three, but then you should choose from among those. I don't know of many trivial compiler books, but, yes there are a number that are more theoretical than I like. C is a nice, simple language in which to describe compiler design, and also not so bad a language in which to write compilers. Given that, it isn't a bad start toward writing one for another language, and/or written in another language, unless you don't know C. Both C and Java are fairly simple, and reasonably similar, with much of the complication moved to the library. That means a complete compiler can be described relatively simply, covering all the important ideas. Once you learn those, you will be ready to go on to other languages (both for compiling and writing the compiler in). You don't say what language you are interested in. There are some complications to writing Fortran compilers not covered in most books. Both Fortran and PL/I don't have reserved words, which requires special handling by the compiler. Fixed form Fortran ignores blanks, which requires a special lexical analysis technique, but most of compiler theory is in parsing, which is reasonably language independent. It seems to me natural that a pseudo-code description will be more theoretical, and harder to understand, than one using a well-known high-level language. -- glen
[toc] | [prev] | [next] | [standalone]
| From | Hans-Peter Diettrich <DrDiettrich1@aol.com> |
|---|---|
| Date | 2012-04-19 14:20 +0200 |
| Message-ID | <12-04-032@comp.compilers> |
| In reply to | #570 |
glen herrmannsfeldt schrieb: > C is a nice, simple language in which to describe compiler design, and > also not so bad a language in which to write compilers. Given that, > it isn't a bad start toward writing one for another language, and/or > written in another language, unless you don't know C. <rant from the hate-C fraction> C is an ugly language, featured (and widely used) to write cryptic code. In practice it's useless without another language, used in the preprocessor (and more languages used in "make" and the autobloat tools). Even an inventor of that language acknowleged later, that he better should have followed Wirth's advice, to e.g. make the language LL(1). The strength of C is writing low level (OS) code, but it lacks many features desireable in *managing* (such) big applications. This issue has been addressed in C++, C# and Java, later, but who would advice an newbie to implement an compiler for C++, which IMO also is everything but a "nice" or easily understandable language? But of course you are right in so far, that a C/C++ compiler is one of the best examples, where one can study much required theory, which is not required for writing compilers for better designed languages. </rant> Just my $0.02 ;-) DoDi
[toc] | [prev] | [next] | [standalone]
| From | compilers@is-not-my.name |
|---|---|
| Date | 2012-04-19 19:05 +0000 |
| Message-ID | <12-04-044@comp.compilers> |
| In reply to | #570 |
gah@nospam.ugcs.caltech.edu wrote > You might be right that all books are one (or more) of those three, > but then you should choose from among those. If that would have been an option I would have done it by now. > C is a nice, simple language in which to describe compiler design, and > also not so bad a language in which to write compilers. Given that, > it isn't a bad start toward writing one for another language, and/or > written in another language, unless you don't know C. I don't know C and it's not a good choice on z/OS. I am familiar with assembler and I used to know PL/I fairly well and could come up to speed with it and use it if it would be a good implementation choice. I don't think it would though, because it requires the IBM runtime which is licensed. > Both C and Java are fairly simple, and reasonably similar, with much > of the complication moved to the library. That means a complete > compiler can be described relatively simply, covering all the > important ideas. Once you learn those, you will be ready to go on to > other languages (both for compiling and writing the compiler in). I really don't like C or Java and I didn't come out and say it because I don't mean to start a holy war. I have looked at them. C just doesn't have much value on z/OS. Java is too limiting in other ways. I am familiar with the older languages and never was interested in much of anything that came later although I have some experience with modern scripting languages. > You don't say what language you are interested in. I am not exactly sure. I was considering a subset PL/I or PL/M variant or maybe even a new language. Even a super Pascal or Modula-something would be interesting to me. > There are some complications to writing Fortran compilers not covered in > most books. Both Fortran and PL/I don't have reserved words, which > requires special handling by the compiler. Fixed form Fortran ignores > blanks, which requires a special lexical analysis technique, but most of > compiler theory is in parsing, which is reasonably language independent. I think Fortran would be hard because I couldn't write the libraries needed due to my lack of mathematical background. F77 would be an interesting project, the latest Fortran is way more complicated than I would attempt. PL/I is interesting because I have access to old and new PL/I compilers and good doc for z/OS. I figured I could develop the grammar from the manuals but I know it would be a huge project, more than I have the time and ability to do and a better PL/I than I or many people could write already exists, so there's not much point in it. > It seems to me natural that a pseudo-code description will be more > theoretical, and harder to understand, than one using a well-known > high-level language. That's a bit of a tautology. If the well-known language is something /you/ know then yes! Otherwise..
[toc] | [prev] | [next] | [standalone]
| From | Uli Kusterer <ulimakesacompiler@googlemail.com> |
|---|---|
| Date | 2012-04-21 11:30 +0200 |
| Message-ID | <12-04-057@comp.compilers> |
| In reply to | #587 |
On 19.04.2012, at 21:05, compilers@is-not-my.name wrote: >> You might be right that all books are one (or more) of those three, >> but then you should choose from among those. > > If that would have been an option I would have done it by now. But it *is* an option. If a book is written in pseudocode (which you requested) you would go and write your own program by translating that pseudocode into whatever your implementation language eventually ends up being. So if a book is written in C, just treat it like a pseudocode that is assembler-like, with shorthand for function prologs and epilogs. C is a "portable assembler". It's a fairly natural fit if you plan on using assembler. > C just doesn't have much value on z/OS. Java is too limiting in other ways. I'm a bit confused now. You said you didn't want to copy and paste. Why does the code suddenly need to "have value"? Isn't it perfectly fine as an illustration of the concepts discussed in the book? If you want to learn how cooking works, why would you worry that the example of cooking soup uses Maggi soups, while all you have is store brand? Cheers, -- Uli Kusterer http://stacksmith.com
[toc] | [prev] | [next] | [standalone]
| From | Roberto Waltman <usenet@rwaltman.com> |
|---|---|
| Date | 2012-04-18 22:00 -0400 |
| Message-ID | <12-04-029@comp.compilers> |
| In reply to | #562 |
Not a direct answer to your question - Stanford University is offering an online compiler course starting April 23. You may want to take it, (it's free.) Details here: https://www.coursera.org/course/compilers Now, regarding a compiler textbook with a good balance between theory and implementation details, I always recommend Pyster's "Compiler Design and Construction" It is dated, (as proven by the choice of source and target languages: "Rascal" [Rudimentary Pascal] and IBM 370 assembler) but still an excellent guide for your first attempts at compiler writing. I believe it is a much easier first read than both LCC and the Dragon book. Adapting it to languages you know will deepen your understanding of how it works. Another good choice (language wise) could be the Oberon compilers. -- Roberto Waltman
[toc] | [prev] | [next] | [standalone]
| From | compilers@is-not-my.name |
|---|---|
| Date | 2012-04-19 11:31 +0000 |
| Message-ID | <12-04-035@comp.compilers> |
| In reply to | #572 |
usenet@nospam.rwaltman.com wrote > Not a direct answer to your question - Stanford University is offering > an online compiler course starting April 23. You may want to take it, > (it's free.) Thanks I saw that and was very excited, until I learned it was the usual environment, that doesn't help me. > Now, regarding a compiler textbook with a good balance between theory > and implementation details, I always recommend Pyster's "Compiler > Design and Construction" > It is dated, (as proven by the choice of source and target languages: > "Rascal" [Rudimentary Pascal] and IBM 370 assembler) but still an > excellent guide for your first attempts at compiler writing. Now you're talking! This could be the one! I will try to find a copy, thank you! > I believe it is a much easier first read than both LCC and the Dragon > book. > Adapting it to languages you know will deepen your understanding of > how it works. > Another good choice (language wise) could be the Oberon compilers. I don't generally like the Wirth languages because they often have built in limitations that make them unsuitable for real work. However they do seem amenable to changing them so that they are useful. People took Pascal and Modula-2 in new directions and many variations are supposed to be pretty good. I'll look at Oberon again now that you mention it. Thanks for your post!
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2012-04-20 07:02 +0000 |
| Message-ID | <12-04-046@comp.compilers> |
| In reply to | #578 |
compilers@is-not-my.name wrote: (snip) >> It is dated, (as proven by the choice of source and target languages: >> "Rascal" [Rudimentary Pascal] and IBM 370 assembler) but still an >> excellent guide for your first attempts at compiler writing. (snip) > I don't generally like the Wirth languages because they often have built in > limitations that make them unsuitable for real work. However they do seem > amenable to changing them so that they are useful. People took Pascal and > Modula-2 in new directions and many variations are supposed to be pretty > good. I'll look at Oberon again now that you mention it. Thanks for your > post! One Wirth language that you might find interesting is PL/360. PL/360 looks like a high-level language but works like assembly language. As an example (which I am remembering from 40 years ago) R1=R1+R1+R1; compiles to LR R1,R1 AR R1,R1 AR R1,R1 and so multiplies R1 by four. Note that it is low level in that the registers are represented by variables such as R1. The PL/360 compiler, and its generated code, should run just fine on z/OS. It is available in PL/360 source, so you can modify it and play with it all you want. I might have some idea what you are asking about, though. Much of my early programming work was with OS/360. First Fortran, but after not so long PL/I. PL/I was much more fun to program in, but not so many systems had PL/I compilers available. Also, not so much later I started S/360 assembler programming. I worked on many other systems over the years, PDP-10, VAX, 80286 (running MSDOS and later OS/2), Sun, HP, and more. Still, S/360 was always my favorite. But I don't understand your refusal to use the tools that are available. FLEX and BISON are freely available, you can't complain that they cost too much. You can run them on a freely available OS (Linux, FreeBSD, Solaris, etc.) on machines that you can find for very low prices, or often enough given away. The nice thing about the tools is that you can get something running fairly fast, and without needing to get too deep into the math. You can go as deep or shallow into the innards of FLEX and BISON as you want. One project that should be about right for one person, and without a lot of math, is rewriting FLEX and BISON to generate code in another language, such as PL/I. As I mentioned before, with LCC and the LCC book, it is pretty easy to write a new code generator without rewriting the rest of the compiler. Writing a PL/I front end for LCC would be somewhat more work, though. There were some working on a PL/I front-end for gcc, though I haven't heard much about that for some time now. -- glen [PL/360 was a great little language, but the source code to the compiler was apparently lost. -John]
[toc] | [prev] | [next] | [standalone]
| From | compilers@is-not-my.name |
|---|---|
| Date | 2012-04-22 11:10 +0000 |
| Message-ID | <12-04-064@comp.compilers> |
| In reply to | #589 |
glen herrmannsfeldt <gah@nospam.ugcs.caltech.edu> wrote: > One Wirth language that you might find interesting is PL/360. > > PL/360 looks like a high-level language but works like assembly > language. As an example (which I am remembering from 40 years ago) I have the doc and compiler code, everything was released into the public domain. It's so close to assembler I didn't consider it might be a good way to learn to write a compiler but maybe it is. A 10 second look shows it's pretty heavily abstracted. I will have to spend more time on it but it may be more a tribute to the traditional Wirth terseness than something to learn from, at least without the professor around to ask questions of. > But I don't understand your refusal to use the tools that are > available. As I said they're not available on my target platform. > FLEX and BISON are freely available, you can't complain that they cost too > much. True but irrelevant! > You can run them on a freely available OS (Linux, FreeBSD, Solaris, etc.) > on machines that you can find for very low prices, or often enough given > away. Ok but those aren't my targets. I'm not interested in using those for this project, as I said. And I would really like to understand what I am doing and the way I have always done that is to write my own code. Why is that upsetting (hard to understand, etc.) to you? I haven't mentioned the cost of anything, I'm not sure where you are coming from here. > The nice thing about the tools is that you can get something running > fairly fast, and without needing to get too deep into the math. You > can go as deep or shallow into the innards of FLEX and BISON as you > want. One project that should be about right for one person, and > without a lot of math, is rewriting FLEX and BISON to generate code in > another language, such as PL/I. It would be nice to "get something running fairly fast" but if I do that depending on other pieces I don't understand it doesn't really help me. I want to learn as much as I can doing this. > [PL/360 was a great little language, but the source code to the > compiler was apparently lost. -John] I believe Jay Maynard is hosting several PL/360 packages. AFAIK they are complete. [If so, they'd be a good place to start. It's basically an assembler with Algol syntax, so it has a real parser. -John]
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2012-04-22 23:56 +0000 |
| Message-ID | <12-04-076@comp.compilers> |
| In reply to | #607 |
compilers@is-not-my.name wrote: (snip, I wrote) >> One Wirth language that you might find interesting is PL/360. >> PL/360 looks like a high-level language but works like assembly >> language. As an example (which I am remembering from 40 years ago) > I have the doc and compiler code, everything was released into the > public domain. It's so close to assembler I didn't consider it might > be a good way to learn to write a compiler but maybe it is. A 10 > second look shows it's pretty heavily abstracted. I will have to spend > more time on it but it may be more a tribute to the traditional Wirth > terseness than something to learn from, at least without the professor > around to ask questions of. Well, there are a few different things you need to know to write a compiler. One is how to write parsers. Assemblers usually don't need much parsing, but for something like PL/360 you need most of the same parser you would for a high-level language. The code generator will be much simpler, though. Parsing theory is fairly well understood, though that doesn't mean it is easy to learn. The theory for code generators is still somewhat of an art, especially for the newer processors like Itanium. (I have an actual Itanium RX2600 running VMS, but likely won't ever try to write a compiler for it.) >> But I don't understand your refusal to use the tools that are >> available. > As I said they're not available on my target platform. There is an IBM supplied C compiler for z/OS. I don't know how much it costs, though. Personally, I wouldn't mind having a z/OS machine at home but can't afford one. (I might afford the hardware, but not the OS.) I even don't mind writing JCL. By 9th grade, I was reading IBM manuals like books, could write my own JCL, and it never bothered me to do it. I presume compiling FLEX and BISON on the IBM C compiler would be pretty easy. But even so, you could do everything as a cross compiler, running on another machine generating z/OS assembler code, then copying it and assembling on z/OS. >> FLEX and BISON are freely available, you can't complain that >> they cost too much. > True but irrelevant! >> You can run them on a freely available OS (Linux, FreeBSD, >> Solaris, etc.) on machines that you can find for very low >> prices, or often enough given away. I can't afford z/OS, but I can other systems. I don't mind working on those other systems, even generating code for machines I don't have. > Ok but those aren't my targets. I'm not interested in using > those for this project, as I said. And I would really like > to understand what I am doing and the way I have always done > that is to write my own code. Why is that upsetting (hard to > understand, etc.) to you? I haven't mentioned the cost of > anything, I'm not sure where you are coming from here. Sometimes what you write seems like whining. Yes, I would like to have a z/OS machine, running the IBM Enterprise PL/I compiler, VS Fortran, Fortran H Extended, and a few other compilers and assemblers. I don't have those, so I work with what I have. >> The nice thing about the tools is that you can get something running >> fairly fast, and without needing to get too deep into the math. You >> can go as deep or shallow into the innards of FLEX and BISON as you >> want. One project that should be about right for one person, and >> without a lot of math, is rewriting FLEX and BISON to generate code in >> another language, such as PL/I. > It would be nice to "get something running fairly fast" but if I > do that depending on other pieces I don't understand it doesn't > really help me. I want to learn as much as I can doing this. It is difficult to learn everything at the same time. I suppose you could write everything in assembler, or even punch the binary codes directly into punched cards. Using high-level languages makes it a little easier. People use tools because it gets them where they want to be faster. Reminds me of the instructions for submitting bug reports to GNU. They expect to use the debugger to find problems, and so don't need the low level details that one might otherwise supply. I pretty much never debugged from hex dumps, but usually knew my programs well enough that if I knew close to where the problem was, I could figure it out. Sometimes I might consider using a debugger as cheating. You could learn all about how to write parsers, convince yourself that BISON generated parsers according to theory that you understood, and then allow yourself to use it. As I wrote, rewriting BISON in PL/I, and to generate parsers in PL/I might be a nice project to keep someone busy, and also learn about how it works at the same time. (Especially if you don't like C.) You could also write your own parser generator, in your favorite language, generating code in your favorite language, and using your favorite parsing method. That would be more work, though, but you would learn more that way. >> [PL/360 was a great little language, but the source code to the >> compiler was apparently lost. -John] > I believe Jay Maynard is hosting several PL/360 packages. > AFAIK they are complete. > [If so, they'd be a good place to start. It's basically an assembler > with Algol syntax, so it has a real parser. -John] I thought PL/360 source was available, and ALGOL W was lost, but I could have forgotten. There is now a scanned source listing of some version, likely not the last, of ALGOL W. (Written in PL/360.) Not so long after I started learning Fortran, about the time I was learning PL/I, I had an ALGOL W manual. I remember being impressed that it allowed 256 character identifiers, compared to six for Fortran. It might be that I never tried running it, though. -- glen
[toc] | [prev] | [next] | [standalone]
| From | ArarghMail204@Arargh.com |
|---|---|
| Date | 2012-04-24 19:13 -0500 |
| Subject | Re: PL/360, was Good practical language and OS agnostic text? |
| Message-ID | <12-04-083@comp.compilers> |
| In reply to | #589 |
On Fri, 20 Apr 2012 07:02:58 +0000 (UTC) <snip> > >[PL/360 was a great little language, but the source code to the >compiler was apparently lost. -John] Not entirely. I found a copy online: http://pastebin.com/2jZpufS6 but at a quick glance, it does not match the listing I am looking at, one that I printed out way back in the early 70's. And, the listing is bigger than I am willing to key, about 50 pages of line printer output. I will look at converting the online copy back to match my listing, sometime. I used to have a copy on tape, that I got in the early 70s, but I doubt that it is still readable. Besides, all of my 1/2 inch tape drives have died. :-( Except for the one that runs on 48V DC, for which I don't have a power supply. And I haven't seen it in years. :-) arargh -- ArarghMail204 at [drop the 'http://www.' from ->] http://www.arargh.com BCET Basic Compiler Page: http://www.arargh.com/basic/index.html
[toc] | [prev] | [next] | [standalone]
| From | Bakul Shah <usenet@bitblocks.com> |
|---|---|
| Date | 2012-04-18 21:15 -0700 |
| Message-ID | <12-04-030@comp.compilers> |
| In reply to | #562 |
Check out Nils M Holm's "Practical Compiler Construction", available at lulu.com. It is a 365 page "tour" through a *complete* compiler for a subset of C language. The compiler can compile itself and you can download the code from author's site (www.t3x.org). It doesn't use lex or yacc (just a hand-rolled scanner and a recursive descent parser). The compiler is about 4300 lines of code. It describes all the key concepts but given the simple design doesn't go into a lot of details (beyond describing the code). The book describes a i386 code generator. The code generator interface seems well enough abstracted. When challenged, Nils put together a x86-64 backend in a day! I have just skimmed the book so far but compared to the Fraser and Hanson C compiler book this is a much simpler book, doesn't go in as much depth but seems to be an easy read. So a good beginner book but you'd do well to consult other books later.
[toc] | [prev] | [next] | [standalone]
| From | compilers@is-not-my.name |
|---|---|
| Date | 2012-04-20 16:06 +0000 |
| Message-ID | <12-04-050@comp.compilers> |
| In reply to | #573 |
Bakul Shah <usenet@nospam.bitblocks.com> wrote: > Check out Nils M Holm's "Practical Compiler Construction", available > at lulu.com. It is a 365 page "tour" through a *complete* compiler for > a subset of C language. The compiler can compile itself and you can > download the code from author's site (www.t3x.org). It doesn't use > lex or yacc (just a hand-rolled scanner and a recursive descent > parser). The compiler is about 4300 lines of code. It describes all > the key concepts but given the simple design doesn't go into a lot of > details (beyond describing the code). The book describes a i386 code > generator. The code generator interface seems well enough abstracted. > When challenged, Nils put together a x86-64 backend in a day! Thanks for the description on this. I have downloaded a bunch of free books over the years and I do have this one. Part of my problem is sorting through them and understanding if they're something I could use. Your comments are very helpful especially since you mentioned he explains all the code and doesn't use external tools.
[toc] | [prev] | [next] | [standalone]
| From | torbenm@diku.dk (Torben Ægidius Mogensen) |
|---|---|
| Date | 2012-04-19 14:58 +0200 |
| Message-ID | <12-04-037@comp.compilers> |
| In reply to | #562 |
compilers@is-not-my.name writes: > Guys, I'm having a bear of a time finding a good practical language > and OS agnostic text on writing a compiler. I'm weak in math and not > interested in the theoretical details. I want to understand the hows > and whys of compiler writing. Everything I've found is either > gobbledygook equations or "let's use C/C++/Java on UNIX" or things > that are so trivial and focused they don't explain general cases and > can't be extended to anything useful. You could have a look at my book "Introduction to Compiler Design" (http://www.springer.com/computer/swe/book/978-0-85729-828-7), or the free-to-download earlier version called "Basics of Compiler Design" (http://www.diku.dk/hjemmesider/ansatte/torbenm/Basics/index.html). The books are language agnostic, describing techniques independently of any specific implementation langauge, and mostly independently of the source and target languages for the compilers. There is some math, but not as much as in some other compiler textbooks I have seen. I wrote the book mainly as a reaction to the books available at the time, which were either (IMO) too advanced for students just beginning the second year of CS or basically walk-throughs of specific compilers for and in specific languages and, hence, not generally useful. Torben
[toc] | [prev] | [next] | [standalone]
| From | compilers@is-not-my.name |
|---|---|
| Date | 2012-04-20 16:06 +0000 |
| Message-ID | <12-04-049@comp.compilers> |
| In reply to | #580 |
torbenm@nospam.diku.dk (Torben Fgidius Mogensen) wrote: > You could have a look at my book "Introduction to Compiler Design" Thanks for the links. > The books are language agnostic, describing techniques independently of > any specific implementation langauge, and mostly independently of the > source and target languages for the compilers. There is some math, but > not as much as in some other compiler textbooks I have seen. I will look them over. It is nice to know the author is available! > I wrote the book mainly as a reaction to the books available at the > time, which were either (IMO) too advanced for students just beginning > the second year of CS or basically walk-throughs of specific compilers > for and in specific languages and, hence, not generally useful. That's an issue for me with not much theoretical background and wanting to at least learn enough so I can go off on my own and do something useful. Thank you.
[toc] | [prev] | [next] | [standalone]
| From | "Joe Schmo" <askmeforit@myisp.com> |
|---|---|
| Date | 2012-04-21 02:53 -0600 |
| Message-ID | <12-04-054@comp.compilers> |
| In reply to | #562 |
<compilers@is-not-my.name> wrote in message news:12-04-019@comp.compilers... > Guys, I'm having a bear of a time finding a good practical language > and OS agnostic text on writing a compiler. I'm weak in math and not > interested in the theoretical details. I want to understand the hows > and whys of compiler writing. Everything I've found is either > gobbledygook equations or "let's use C/C++/Java on UNIX" or things > that are so trivial and focused they don't explain general cases and > can't be extended to anything useful. The first few chapters of "Programming Language Pragmatics" by Michael Scott for a good and fast overview. (The rest of the book is quite good also if you are designing your own language). "Writing Compilers & Interpreter - An Applied Approach" by Ronald Mak. Creates a Pascal compiler in C which emits x86 assembly language. The Fischer and LeBlanc authored book is good for the implementation details. I.e., their particular take on an implementation anyway. It sticks in my mind that this is a very good book (but I somehow lost the mini review I made for myself about it) that I will obtain again in the future. I think the whole "write a grammar and feed it through a tool to produce a lexer and parser" thing is something to avoid, at least at first (I'm avoiding it like the plague, FWIW). Surely that paradigm is part of the reason that programming languages are so complex. [COBOL managed to have arcane syntax and hundreds of reserved words before there were any compiler tools at all. That's not it. -John]
[toc] | [prev] | [next] | [standalone]
| From | Uli Kusterer <ulimakesacompiler@googlemail.com> |
|---|---|
| Date | 2012-04-22 16:18 +0200 |
| Subject | Re: Writing parsers, was Good practical language and OS agnostic text? |
| Message-ID | <12-04-068@comp.compilers> |
| In reply to | #597 |
On 21.04.2012, at 10:53, Joe Schmo wrote: > I think the whole "write a grammar and feed it through a tool to produce a > lexer and parser" thing is something to avoid, at least at first (I'm > avoiding it like the plague, FWIW). While I generally think that compiler-compilers and parser and lexer generators are great domain-specific languages that help streamline the process (at least if your language fits in their constraints, which for example my pet language doesn't do), I also had huge problems using them at first. Without knowing the problems and the general approach that is taken when writing a parser, some of the things these tools do seem awfully roundabout and over-complicated. It helped me a lot to just write my own lexers and parsers, because then it suddenly became apparent what the problems *are* that these tools protect me from. Cheers, -- Uli Kusterer http://stacksmith.org
[toc] | [prev] | [next] | [standalone]
| From | compilers@is-not-my.name |
|---|---|
| Date | 2012-04-23 19:12 +0000 |
| Message-ID | <12-04-080@comp.compilers> |
| In reply to | #597 |
"Joe Schmo" <askmeforit@nospam.myisp.com> wrote: > The first few chapters of "Programming Language Pragmatics" by Michael Scott > for a good and fast overview. (The rest of the book is quite good also if > you are designing your own language). Thanks. > "Writing Compilers & Interpreter - An Applied Approach" by Ronald Mak. > Creates a Pascal compiler in C which emits x86 assembly language. > The Fischer and LeBlanc authored book is good for the implementation > details. I.e., their particular take on an implementation anyway. It sticks > in my mind that this is a very good book (but I somehow lost the mini review > I made for myself about it) that I will obtain again in the future. Thanks, I'll look for both of these. For now I will start with the IBM-based books since they will be the easiest for me to understand. Thanks to everyone for the suggestions.
[toc] | [prev] | [next] | [standalone]
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
Back to top | Article view | comp.compilers
csiph-web