


Detailed explanation of PC-side WeChat code scanning registration and login example code
This article explains in detail the PC-side WeChat code scanning registration and login example code
After writing the lexical part, there are a lot of chores, and I finally have time on the weekend to implement the great grammar parsing part.
After finishing the code, I found that the program was too short. Not counting the state machine, it only had 186 lines (including comments), and the key code was less than 100 lines. After running Debugging, I found that it was OK. It can actually parse function.php in OneThink. This file can be called the master of Php programs. There are all kinds of monsters and monsters in it. It is really painful to debug it. Of course I won’t tell you, haha
Since the program is too short, I’m going to explain it in detail in case everyone doesn’t understand. The secret:)
We know that grammar analysis generally includes LL(1), LR(0), SLR(1), LALR(1), LR(1) and other analysis methods. The more common ones are LL(1),LR(0)
. This analysis method scans from left to right and deduces to the far left; LR scans from left to right and deduces to the right; LL adopts LR uses a prediction table, while LR uses an analysis table; the difficulty of LR is higher than that of LL, and its analytical ability is also higher than that of LL. Moreover, LR has more changes. Therefore, for such a fun project, of course, LR must be used to steadily create (zhuang) new (bi).
The model of the LR analyzer is as shown below.
Includes two stacks, the most important of which is generating LR analysis tables. Of course, I am not going to follow the classic methods in the textbook honestly. How to create (tou) new (lan)? This is the key.
We see that SLR(1), LALR(1), and LR(1) are all improvements to LR(0). The most important one is (1), which represents looking forward. Why look forward? To reduce the size of the analysis table. There are countless possibilities in the future. Looking forward, the possibilities decrease and the scale of analysis will also be greatly reduced. If we want to reduce the scale of analysis, we must look forward, and the more we look, the smaller the analysis table will be, and conversely, the more difficult programming will be. So, is there a way for me to make money while standing without looking forward, without increasing the difficulty and reducing the analysis table?
Yes, there really is. This is not a problem for a senior lazy man. We know that the need to look forward comes from grammarexpression: such as A → Abc, the longer the length of its single expression, the greater the uncertainty. Therefore, limiting the maximum length of method expressions can ensure 100% certainty within this length, and there is no need to look ahead at all. I named this method limited length LR, that is, LLLR(0,n), n>=3.
So, this time I naturally chose LLLR(0,3) as the analysis method, and for the convenience of implementation, I decided not to save the state, so there is no need to generate an analysis table, and the table will not be generated. The table is no longer generated...
Damn it! This is too lazy. Not saving the state means that you need to search from the beginning every time. Efficiency is the life of a programmer!
Don't worry, the maximum length of the expression is 3, and the maximum search step is 3 steps. Don't worry, that's it. :) This is the secret of the 100-line ultra-simple Php compiler. How about, let’s create something new (bi). The source code is here: converterV0.4.zip Enjoy!
The above is the detailed content of Detailed explanation of PC-side WeChat code scanning registration and login example code. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

How to avoid being detected when using FiddlerEverywhere for man-in-the-middle readings When you use FiddlerEverywhere...

How to teach computer novice programming basics within 10 hours? If you only have 10 hours to teach computer novice some programming knowledge, what would you choose to teach...

When using Python's pandas library, how to copy whole columns between two DataFrames with different structures is a common problem. Suppose we have two Dats...

How does Uvicorn continuously listen for HTTP requests? Uvicorn is a lightweight web server based on ASGI. One of its core functions is to listen for HTTP requests and proceed...

Fastapi ...

Using python in Linux terminal...

Understanding the anti-crawling strategy of Investing.com Many people often try to crawl news data from Investing.com (https://cn.investing.com/news/latest-news)...
