๐Ÿ“š Agora location [[20210516173242 lexical_analysis_in_racket]] โ˜†
Agora locations contain community contributions with titles or topics that match your search. x
๐Ÿ“„ literature/20210516173242-lexical_analysis_in_racket.md by @ryan โ˜† raw

Lexical Analysis in Racket

source : Lexical analysis in Racket

tags : [[lexical analysis]]

Notes

[[Racket]] has a library for making [[lexers]] easily: parser-tools/lexer.

#lang racket/base
(require parser-tools/lexer)

(define ab-lexer 
 (lexer 
   [#\a  (display "You matched a.\n")]
   [#\b  (display "You matched b.\n")]))

This will create a lexer that matches input character by character until, finally, returning 'eof.

The rest of this article contains a number of useful examples.

Loading pushes...

โœจ AI Synthesis Mistral Gemini x

Expanding this section will automatically generate an AI synthesis of the contributions in this node.

Rendering context...