Lecture 11 Notes

we associate a name

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ), and ¡  ¦ ¤     ©    ¢ £ 15 ¢ ¢ £¡ ¡ # $ ¥ ¡  ¥© The name is a Scheme symbol. It is the name of lexical class being defined. ¡ ¤    §    ¤ ¡¢ ¢ #    ¦ ¦   ¦ ¦ ¤  ¡    ¤  ¡ ¥ ©  ¢  ¨#  ¡¢ ¢ ¢ '  ¡    ¤  ¡ ¥ ©   ¢ '  ¢ ¨#  #  ¢   '  ©  ¢  ¨# ¥   ¨ ¢ £  ¥ ©  © '  ¢ ¨# ¡  ¦ ¢  ¥ ©   '  ¢ ¨# ¥  ¡  ©  ¢  ©  ¢  ¨#   ¥  ¡  © ¥¡£¡   ¤¢ ¢ ¡¡ § ¥ §   ¥    ¥ §  ¦ ¢¢¡  %    ¡   ¥ §  ¢       ¦    §¥£¡ %¡ ¢ § %  ¡ ¨¦¤¢ ¢  ©  ¦ ¢¢¡    ¡¡ ¡ ¢ ¢ ¨# %  ¡ § ¢ § ¡   ©   ¥¡¢  %  ¤¢  ¨# © ¥¡¢  §£ ' ¤¢ ¦ ¢¡¢¡     $ ¥    ¥     ¡ # ¤ %  ¡¢ ¢ ¥¢ ¢ ¥ §  % ¦ ¢¢¡ ¥ §           ¡ ¥  ¡¡ ¤¢ ¢ % ¢ ¥¡£¡ ¥ ¥ A scanner is a list. Each item in the list is a specification of a regular expression, consisting of a name, a sequence of regular expressions, and an action to be taken on success. '¥     ¨ As the scanner works, it collects characters into a buffer. When the scanner determines that it has found the longest possible match of all the regular expressions in the specification, it executes the outcome of the corresponding regular expression. An outcome can be one of the following: The symbol . This means this is the end of a token, but no token is emitted. The scanner continues working on the string to find the next token. This action is used for whitespace and comments. The class name is ignored.  ¤ ¥©  ¨£ # © § ' The symbol . The characters in the buffer are converted into a Scheme symbol and a token is emitted, with the class name as its class and with the symbol as its datum. ¡£#¥ The symbol . The characters in the buffer are converted into a Scheme number, and a token is emitted, with the class name as its class and with that number as its datum.  ¥  ¡  © The symbol . The characters in the buffer are converted into a Scheme string, and a token is emitted, with the class name as its class and with that string as its datum.  ¥  ¡  © If there is a tie for longest match between two regular expressions, takes precedence over (so keywords that would otherwise be identifiers show up as keywords).  ¨£ # © § ' 16 17 © © ¤ ¥ §  ¦©  ¡  %  ¦¥§¦ ¤ ¥ § ¦©  ¡   ¦ ©  % % ¦...
View Full Document

Ask a homework question - tutors are online