A summary of lexical analysis experiments

Source: Internet
Author: User

First, theoretical knowledge

1. The task of lexical analysis phase is to scan and decompose the string composing the source program from left to right, and identify a word symbol with independent meaning according to the lexical rules of the language.

2, the word law is the formation of the word symbol rules. It is divided into basic words, identifiers, constants, operators, and bound characters.

Second, the experimental experience

1, before always put other functions together into the main function, after this experiment, the function of the call more familiar.

2, learned a new input method, using scanf ("%[^#]s", input) can be the end of the logo as #, simple and convenient.

3, the string ends with a, so when reading to the last time to set the case.

4, the string as a small part of the read. Read the character, encounter a space or other special symbols to the subscript back one bit, judge just plain string basic words, identifiers, constants, operators, bounds, and then output, read part, output part, loop. The first thing to consider is that the input is a space and the output character is not within the defined range or is not entered.

5, read, splicing, loop, subscript back, output

A summary of lexical analysis experiments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.