![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I just wrote an attribute grammar for the general object-encoding rules. (Not all of BER; that's next. Just section 8.1 of X.690.) Unless sections 8.2 through 8.22 throw me a curveball, which it doesn't look like they will, QED. It's fully left-recursive and uses only synthesized attributes, for all your efficient parsing needs. Boo yah.
If anyone playing along at home wants to have a look, drop me a comment.
FWIW, attribute grammars are absurdly simple in Haskell; Happy supports them natively. (Attribute grammars are somewhat intractable in strictly-evaluated languages because if you have to use strict evaluation, the data dependency graph gets impractically large very quickly. Haskell, which uses lazy evaluation, doesn't have this problem. Every day I come to love this little language more and more. Oh, and I can do a multiple-entry-point approach to support CER and DER. Seriously, how cool is that?)
Don Knuth, Haskell Curry, Simon Peyton-Jones, Simon Marlow and Andy Gill are totally my heroes forever and ever.
If anyone playing along at home wants to have a look, drop me a comment.
FWIW, attribute grammars are absurdly simple in Haskell; Happy supports them natively. (Attribute grammars are somewhat intractable in strictly-evaluated languages because if you have to use strict evaluation, the data dependency graph gets impractically large very quickly. Haskell, which uses lazy evaluation, doesn't have this problem. Every day I come to love this little language more and more. Oh, and I can do a multiple-entry-point approach to support CER and DER. Seriously, how cool is that?)
Don Knuth, Haskell Curry, Simon Peyton-Jones, Simon Marlow and Andy Gill are totally my heroes forever and ever.
(no subject)
Date: 2009-08-11 08:37 pm (UTC)(no subject)
Date: 2009-08-11 08:42 pm (UTC)(no subject)
Date: 2009-08-11 08:53 pm (UTC)(no subject)
Date: 2009-08-11 09:05 pm (UTC)(no subject)
Date: 2009-08-14 11:57 am (UTC)(no subject)
Date: 2009-08-11 09:22 pm (UTC)(no subject)
Date: 2009-08-12 01:51 pm (UTC)Hackage?
Date: 2009-08-12 10:27 pm (UTC)Re: Hackage?
Date: 2009-08-12 10:40 pm (UTC)weighing those hammers
Date: 2009-08-14 12:16 pm (UTC)Consider the problem of enforcing variable declarations a la Java. At the level of the grammar, enforcing declaration before use requires a context sensitive grammar (the proof is in Ullmann et al, I will hunt it down if you need it for the thesis), but almost everyone I know of, including the Java Spec, writes context free grammars for Java and lets the compiler bitch about the mismatch.
This really came to the fore for me after some work related research on the question of which natural languages are context-sensitive; it turns out that you can almost always pull apart the opponent's examples by designing your grammar a little bit different--esp in English.
PS: Admittedly, reading the other posts, it looks like attribute grammars allow you to get that very split in your management of the context sensitivity that I was talking about.