Compiler/lexical analyzer: Difference between revisions
m
Read from stdin instead of from a file.
m (Fix a bug in make-this-or-that-handler and use lisp keywords instead of obscure symbols.) |
m (Read from stdin instead of from a file.) |
||
Line 1,822:
*readtable*))
(defun lex
(loop with *readtable* = (make-lexer-readtable)
with counting-stream = (make-instance 'counting-character-input-stream :stream stream)
for
until
do (format
▲ (token-line token) (token-column token) (token-name token) (token-value token))
(line-of counting-stream) (column-of counting-stream) :end-of-input)
(defun main ()
(lex *standard-input*))</lang>
{{out|case=test case 3}}
<pre> 5 16 KEYWORD-PRINT
|