PasteRack.org | ||
Paste # 46383 | ||
2018-12-30 23:29:02 | ||
Fork as a new paste. | ||
Paste viewed 431 times. | ||
Tweet | ||
Embed: | ||
#lang racket (require megaparsack megaparsack/text megaparsack/parser-tools/lex parser-tools/lex data/functor data/monad data/applicative "lexer.rkt") (provide myapl-parse) ; Combinators (define verb/p (syntax/p (token/p 'VERB))) (define number/p (syntax/p (token/p 'NUMBER))) (define mode/p (syntax/p (token/p 'MODE))) (define funcall/p (syntax/p (do [args <- (many/p expression/p #:sep (token/p 'SPACE))] [func <- verb/p] (pure (list* func args))))) (define expression/p (or/p number/p funcall/p)) (define (lex lexer str) (define in (open-input-string str)) (port-count-lines! in) (let loop ([v (lexer in)]) (cond [(void? (position-token-token v)) (loop (lexer in))] [(eof-object? (position-token-token v)) '()] [else (cons v (loop (lexer in)))]))) (define (myapl-parse port) (parse-result! (parse-tokens expression/p (lex port))))
=>
standard-module-name-resolver: collection not found for module path: megaparsack collection: "megaparsack" in collection directories: /home/pasterack/.racket/6.8/collects /home/pasterack/racket68/collects ... [161 additional linked and package directories] context...: show-collection-err standard-module-name-resolver /home/pasterack/racket68/collects/racket/require-transform.rkt:266:2: expand-import /home/pasterack/racket68/collects/racket/private/reqprov.rkt:571:24 /home/pasterack/racket68/collects/racket/private/reqprov.rkt:559:5 /home/pasterack/racket68/collects/racket/require-transform.rkt:266:2: expand-import /home/pasterack/racket68/collects/racket/private/reqprov.rkt:266:21: try-next /home/pasterack/racket68/collects/racket/private/reqprov.rkt:348:21: try-next /home/pasterack/racket68/collects/racket/private/reqprov.rkt:243:2 /home/pasterack/racket68/collects/syntax/wrap-modbeg.rkt:46:4 standard-module-name-resolver loop ...cket/cmdline.rkt:179:51 /home/pasterack/racket68/share/pkgs/scribble-lib/scribble/run.rkt: [running body]