2018-03-29

js_Ast structure

struct js_Ast
{
    enum js_AstType type;
    int line;
    js_Ast *parent, *a, *b, *c, *d;
    double number;
    const char *string;
    js_JumpList *jumps; /* list of break/continue jumps to patch */
    int casejump; /* for switch case clauses */
    js_Ast *gcnext; /* next in alloc list */
};

seems that it is a pure ast tree, but i didnt learn it well when i was at College. There is a website out there to see it clearly. This picture shows it very well.
http://esprima.org/demo/parse.html

图片1.png

when i call read(), it will analyse it carefully, and finally it will become a AST parse list like this. body's type is a AST_LIST, body->a's type is a EXP_CALL, and body->a->a's type is a EXP_IDENTIFIER and it represents string read
图片2.png

error types in JS compile

https://docs.microsoft.com/en-us/scripting/javascript/advanced/strict-mode-javascript
every type of javascript error can be found here, it developped by Microsoft.

the difference between debug and release...

When i compiled it into a debug version, it makes an 8 bytes hole between the buffer and the stack canary...
But when i try to compile it into a release version, there is no such hole... Its ... amazing...
I checked the Makefile and found that the debug version only made an -g in the CFLAGS, and in the release version it added

-Os all compile optimizaion
-Wl set the link library
-s delete the debug symbols and function names

你可能感兴趣的:(2018-03-29)