C # calculator--6 for Imitation Query Analyzer. function Waveform Drawing

Source: Internet
Author: User
Tags expression

The calculator has recently been perfected, added support for variables, added more functions, implemented logical short-circuit operations, and fixed some minor bugs. I remember seeing an example in a book before, enter a function expression, you can draw the waveform of the function. When you first learn VB, you like to use a function to paint. Coupled with a little interest in electronic technology, many waveforms can be expressed using functions, it is natural to think of the program to simulate the display waveform. But because functions need to be written in the code, if you need new functions or make changes, you need to modify the program code and then compile and run. Now that you can do the calculation of the expression, you can also support the variable, so that the value of the variable can be calculated to get different values, and then combine these values into coordinate points, connected to the waveform. As a result, we also try to do a display function waveform of the small program to play, the effect is as follows:

Let's talk about the newly added variable support feature. The variable here does not need to be declared, as long as it is not a reserved keyword, the program takes it as a variable. Encountered in the previous version of the string will not recognize the error, it is now in the analysis of keywords to do a special processing, encountered a non-keyword string is added to a static variable dictionary. The key of the variable dictionary is the string representation of the variable, and value is a Tokenvalue object. After adding to the dictionary, if you encounter the same string again, the corresponding Tokenvalue object in the variable dictionary is returned. Here's an example:

Related Article

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.