File: greetingInGreek.py

package info (click to toggle)
pyparsing 3.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,200 kB
  • sloc: python: 30,867; ansic: 422; sh: 112; makefile: 24
file content (18 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#
# 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 as ppu

# define grammar
alphas = ppu.Greek.alphas
greet = Word(alphas) + "," + Word(alphas) + "!"

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

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