Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] CFG's and OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David McClain <David.McClain@A...>
Subject: [Caml-list] CFG's and OCaml
Heh! I just dug out Andrew Appel's book from the closet and began 
reading it anew.

Lo and behold, he shows how grammars that invite reduce/reduce 
conflicts are best handled by opening up the universe of sytactically 
recognizable sentences -- well beyond anything meaningful for the 
language at hand -- and then using a later semantic analysis stage to 
detect and report the error.

So this explains why the parser.ml for OCaml has all those apparently 
illegal accepting clauses in it. The parser recognizes all kinds of 
wild things that would be patently invalid OCaml code.

I began life in this field more than 30 years ago using a simple 
language called Forth to control a large 100 inch telescope in 
Wyoming... I learned many "bad habits" in programming -- most notably 
to write code that works when fed correct input for its intended 
purpose -- and to hell with what happens in any other case. I watched 
and learned from the practicioners of this language what I came to call 
"Kamakazi Programming Style".

Now after spending the last 30 years trying hard to overcome these 
initial misguidings, I find once again, that this is the appropriate 
solution -- at least in the parsing stage.

Very interesting...

David McClain
Senior Corporate Scientist
Avisere, Inc.

david.mcclain@avisere.com
+1.520.390.7738 (USA)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners