Sha256: 4c1d2ff0cb40676395b223f7ba8466eddee50ca6813680b708bb4dd7391b15bd

Contents?: true

Size: 511 Bytes

Versions: 7

Compression:

Stored size: 511 Bytes

Contents

#
# Stamina recognizes regular expressions thanks the `regular` function.
#

# Let's build a regular language
abstar = regular("(a b)*")

# More complex regular languages may be put on multiple lines
complex = regular <<-LANG
  (a b)+
| a+
| b
LANG

# Sometimes, it is useful to capture the universal regular language
# over an alphabet, that is,
univ = regular("(a | b | c | d | e)*")

# Here is a friendly shortcut, very useful if the alphabet become
# large
univ2 = sigma_star('a'..'e')
assert univ <=> univ2

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stamina-gui-0.6.1 examples/2-regular-languages/1-introduction.rb
stamina-gui-0.6.0 examples/2-regular-languages/1-introduction.rb
stamina-gui-0.5.4 examples/2-regular-languages/1-introduction.rb
stamina-gui-0.5.3 examples/2-regular-languages/1-introduction.rb
stamina-gui-0.5.2 examples/2-regular-languages/1-introduction.rb
stamina-gui-0.5.1 examples/2-regular-languages/1-introduction.rb
stamina-gui-0.5.0 examples/2-regular-languages/1-introduction.rb