[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

simpleparse - what is wrong with my grammar?

Laszlo Nagy

2/24/2008 9:49:00 AM

The program below gives me "segmentation fault (core dumped)".

Environment:
Linux gandalf-desktop 2.6.20-16-generic #2 SMP Tue Feb 12 05:41:34
UTC 2008 i686 GNU/Linux
Python 2.5.1

What is wrong with my grammar? Can it be an internal error in simpleparse?

Thanks,

Laszlo


from simpleparse.common import numbers, strings, comments
from simpleparse.parser import Parser

declaration = r'''
expr := paren_expr/unop_expr/binop_expr/word
paren_expr := "(",expr,")"
unop_expr := unop,expr
binop_expr := expr,binop,expr
unop := ("+"/"-")
binop := ("|"/"&"/"@")
word := [a-zA-Z], [a-zA-Z0-9_]*
'''

parser = Parser( declaration)
success, resultTrees, nextCharacter =
parser.parse("testword",production="expr",processor=None)
print success


3 Answers

Bradipus

6/26/2014 9:09:00 PM

0

jerry kraus 22:26, mercoledì 25 giugno 2014:

> On Wednesday, June 25, 2014 3:01:52 PM UTC-5, Rich Rostrom
> wrote:
>> The Roman Empire, to a certain degree.
>>
>>
>>
>> The Ottoman Empire (the Janizaries could make or unmake a
>> Sultan).
>>
>>
>>
>> Not many others. Bear in mind that the Japanese situation
>>
>> only lasted a few years.
>>
>> --
>>
>> The real Velvet Revolution - and the would-be hijacker.
>>
>>
>>
>> http://originalvelvetrevo...
>
> The unique feature of the Japanese political structure was
> that it was actually easier for a General to unmake a Prime
> Minister than the other way around. I think this may
> actually have been unique in world history -- hence the
> astonishing militarism of the Japanese. The Japanese
> programmed themselves for extreme militarism. They saw this
> as the only way to avoid the fate of the Chinese, who were
> effectively turned into a colony of the Western Military
> Powers. The Chinese don't really see the Imperial Japanese
> as being human -- they call them "gwei", or "demons".
>
> General MacArthur's job one when he took over Japan was
> writing them a new Constitution. They had to be
> "reprogrammed". And, they have been.
>
> Neither the Romans nor the Ottomans had this degree of
> constant military dominance in all aspects of social policy.
> The civil authorities were dominant, most of the time. But,
> as large militaristic empires, the military did from time to
> time crush leaders who they felt would undermine the empire.


Maybe it looks weird but in Switzerland the military and the
civilian are (informally) very intertwined.



--
Bradipus

Rich Rostrom

6/26/2014 9:25:00 PM

0

Bradipus <bradipus@bradip.us.invalid> wrote:


> Maybe it looks weird but in Switzerland the military and the
> civilian are (informally) very intertwined.

"Switzerland does not _have_ an army;
Switzerland _is_ an army."
--
The real Velvet Revolution - and the would-be hijacker.

http://originalvelvetrevo...

Jerry Kraus

6/26/2014 9:42:00 PM

0

On Thursday, June 26, 2014 4:25:29 PM UTC-5, Rich Rostrom wrote:
> Bradipus <bradipus@bradip.us.invalid> wrote:
>
>
>
>
>
> > Maybe it looks weird but in Switzerland the military and the
>
> > civilian are (informally) very intertwined.
>
>
>
> "Switzerland does not _have_ an army;
>
> Switzerland _is_ an army."
>
> --
>
> The real Velvet Revolution - and the would-be hijacker.
>
>
>
> http://originalvelvetrevo...

You know, I think Israel might be a bit like Imperial Japan. A lot of people wondered how a lone assassin could possibly have got close enough to assassinate Prime Minister Rabin. And, a lot of people were not happy with Rabin's peace plans. And, Prime Minister Sharon had his massive stroke rather conveniently for a lot of people, too. And he, too, was beginning to sound rather like a dove, for Sharon, anyway.