summaryrefslogtreecommitdiff
path: root/examples/greetingInGreek.py
blob: 921ac04cb03f05c73f44fda91ca709afd83bad8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# vim:fileencoding=utf-8 
#
# greetingInGreek.py
#
# Demonstration of the parsing module, on the prototypical "Hello, World!" example
#
# Copyright 2004-2016, by Paul McGuire
#
from pyparsing import Word, pyparsing_unicode

# define grammar
alphas = pyparsing_unicode.Greek.alphas
greet = Word(alphas) + ',' + Word(alphas) + '!' 

# input string
hello = "Καλημέρα, κόσμε!"

# parse input string
print(greet.parseString(hello))