diff options
Diffstat (limited to 'src/examples/greetingInGreek.py')
-rw-r--r-- | src/examples/greetingInGreek.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/examples/greetingInGreek.py b/src/examples/greetingInGreek.py new file mode 100644 index 0000000..7869b68 --- /dev/null +++ b/src/examples/greetingInGreek.py @@ -0,0 +1,18 @@ +# vim:fileencoding=utf-8
+#
+# greetingInGreek.py
+#
+# Demonstration of the parsing module, on the prototypical "Hello, World!" example
+#
+from pyparsing import Word
+
+# define grammar
+alphas = u''.join(unichr(x) for x in xrange(0x386, 0x3ce))
+greet = Word(alphas) + u',' + Word(alphas) + u'!'
+
+# input string
+hello = "Καλημέρα, κόσμε!".decode('utf-8')
+
+# parse input string
+print greet.parseString( hello )
+
|