SoobNauce

Untitled

Jun 20th, 2021 (edited)
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.35 KB | None | 0 0
  1. # Delimiter
  2. <SPACE>             ::= " "
  3.  
  4. # Terminal symbols (I call them tokens)
  5. # All caps
  6. # Order is to prevent ambiguity
  7. <EMPTY>             ::= ""# Literal empty string, as a token
  8. <STAR>              ::= "*"
  9. <UNREACHABLE>       ::= "!H"# I would call it !H but you can't
  10.                             # have a variable named that
  11.                             # !H means "Destination host unreachable"
  12.                             #  from traceroute.
  13. <MS>                ::= "ms"
  14. <IP>                ::= <IP_PATTERN># Constant defined at top of file
  15. <HOST>              ::= <HOST_PATTERN># Constant defined at top of file
  16. <INTEGER>           ::= /\d+/# An INTEGER is a valid DECIMAL so we put this
  17.                             # above DECIMAL to remove ambiguity
  18. <DECIMAL>           ::= <DECIMAL_PATTERN># Constant defined at top of file
  19.  
  20. # Rules from beginning of string to end
  21. <Line>              ::= <Empties> <Ttl> <EMPTY> <Responses>
  22.     <Empties>       ::= <EMPTY>*
  23.     <Ttl>           ::= <INTEGER>
  24.     <Responses>     ::= <Hit>
  25.     <Responses>     ::= <Miss>
  26.     <Responses>     ::= <Responses>+
  27.         <Miss>      ::= <STAR>
  28.         <Miss>      ::= <UNREACHABLE>
  29.         <Hit>        ::= <HOST> <IP> <Time>
  30.         <Hit>        ::= <EMPTY> <Time>
  31.             <Time>   ::= <EMPTY> <DECIMAL> <MS>
  32.             <Time>   ::= <EMPTY> <INTEGER> <MS>
Add Comment
Please, Sign In to add comment