DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
(progn
  (defparameter *bew*
    (generate-world
     "BE"
     '((lexer base-example-lexer
              :lalr-1
              :numeral
              ((:digit (#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9) ((value $digit-value))))
              (($digit-value integer digit-value digit-char-36)))
       
       (deftag syntax-error)
       (deftype semantic-exception (tag syntax-error))
       
       (%charclass :digit)
       
       (rule :digits ((decimal-value integer)
                      (base-value (-> (integer) integer)))
         (production :digits (:digit) digits-first
           (decimal-value (value :digit))
           ((base-value base)
            (const d integer (value :digit))
            (if (< d base)
              (return d)
              (throw syntax-error))))
         (production :digits (:digits :digit) digits-rest
           (decimal-value (+ (* 10 (decimal-value :digits)) (value :digit)))
           ((base-value base)
            (const d integer (value :digit))
            (if (< d base)
              (return (+ (* base ((base-value :digits) base)) d))
              (throw syntax-error)))))
       
       (rule :numeral ((value integer))
         (production :numeral (:digits) numeral-digits
           (value (decimal-value :digits)))
         (production :numeral (:digits #\# :digits) numeral-digits-and-base
           (value
            (begin
             (const base integer (decimal-value :digits 2))
             (if (and (>= base 2) (<= base 10))
               (return ((base-value :digits 1) base))
               (throw syntax-error))))))
       (%print-actions)
       )))
  
  (defparameter *bel* (world-lexer *bew* 'base-example-lexer))
  (defparameter *beg* (lexer-grammar *bel*)))

#|
(values
  (depict-rtf-to-local-file
   "Test/BaseExampleSemantics.rtf"
   "Base Example Semantics"
   #'(lambda (rtf-stream)
       (depict-world-commands rtf-stream *bew* :heading-offset 1)))
  (depict-html-to-local-file
   "Test/BaseExampleSemantics.html"
   "Base Example Semantics"
   t
   #'(lambda (html-stream)
       (depict-world-commands html-stream *bew* :heading-offset 1))
   :external-link-base ""))


(lexer-pparse *bel* "37")
(lexer-pparse *bel* "33#4")
(lexer-pparse *bel* "30#2")

|#

(length (grammar-states *beg*))