Meta programming question
Bruce Dickey
brucedickey at micron.com
Mon Sep 29 13:14:24 EDT 2003
More information about the Python-list mailing list
Mon Sep 29 13:14:24 EDT 2003
- Previous message (by thread): Meta programming question
- Next message (by thread): Meta programming question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"David Abrahams" <dave at boost-consulting.com> wrote in message news:ufzih2ali.fsf at boost-consulting.com... > Bruce Dickey <ceiesa at excite.com> writes: > > > Ben Finney wrote: > >> On Sat, 27 Sep 2003 19:18:15 -0600, Bruce Dickey wrote: > >> > >>>I've read a number of the meta progamming articles. I have not found > >>>what I am looking for. I want to override assignments to variables > >>>which are in the module namespace (not object members -- no classes > >>>involved). Can this be done? > >> AFAIK, no. If it were possible, it would be very confusing. > >> What is it you're trying to achieve? Perhaps a better alternative > >> can > >> be suggested that doesn't break expected behaviour. > >> > > I'm investigating the use of Python as a grammar language. I'm trying > > to achive minimal required syntax/verbage. > > Cool! You might take a look at http://spirit.sf.net for some ideas. > Python's a great language for metaprogramming because of its rich > syntax. If you were willing to discourage left-recursion you might go > with something like: > > expression = term._('+').expression | term._('-').expression > > On the other hand, when I had to do something like this I built my own > "python-like" syntax for the grammar rules and left the semantic > actions in pure Python, then ran the files through a simple > preprocessor. It's just too ugly to write grammar rules in pure > python without overloaded whitespace. > > -- > Dave Abrahams > Boost Consulting > www.boost-consulting.com I'll look into it, thanks. But I had essentially come to the same conclusion. Bruce
- Previous message (by thread): Meta programming question
- Next message (by thread): Meta programming question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list