LLVM in 100 Seconds - Phụ đề song ngữ

LLVM, a toolkit used to build and optimize compilers.
Building a programming language from scratch is hard.
You have humans who want to write code in a nice simple syntax, then machines that need to run it on all sorts of architectures.
LLVM standardizes the extremely complex process of turning source code into machine code.
It was created in 2003,
by grad student Chris Latner at the University of Illinois,
and today it's the magic behind clang for C and C++, as well as languages like Rust, Swift, Julia, and many others.
Most importantly, it represents high-level source code in a language-agnostic code called Intermediate Representation, or IR.
This means vastly different languages, like CUDA, and W.
Ruby produce the same IR, allowing them to share tools for analysis and optimization before they're converted to machine code for a specific chip architecture.
A compiler can be broken down into three parts.
The front end parses the source code text and converts it into IR.
The middle end analyzes and optimizes this generated code.
And finally, the back end converts the IR into IR.
native machine code.
To build your own programming language from scratch right now, install LLVM, then create a C++ file.
Now envision the programming language syntax of your dreams.
To make that high level code work,
you'll first need to write a lexer to scan the raw source code and break it into a collection of tokens,
like literals, identifiers, keywords, operators, and so on.
Next, we'll need to define
find an abstract syntax tree to represent the actual structure of the code and how different tokens relate to each other,
which is accomplished by giving each node its own class.
Third, we need a parser to loop over each token and build out the abstract syntax tree.
If you made it this far, congratulations, because the hard part is over.
Now we can import a of LLVM primitives to generate the intermediate representation.
Each type in the abstract syntax tree is given a method called codegen which always returns an LLVM value object used to represent a single assignment register which is a
variable for the compiler that can only be assigned once.
What's interesting about these IR primitives is that unlike assembly they're independent of any particular machine architecture and that dramatically
simplifies things for language developers who no longer need to match the output to a processor's instruction set.
Now the front end can generate IR, the OPT tool is used to analyze and optimize the generated code.
It multiple passes over the IR and does things like dead code elimination and scalar replacement of aggregates.
And finally,
that brings us to the back end where we write a module that takes IR as an input that he met's object code that can run on any architecture.
Congratulations, you just built your own custom programming language and compiler in 100 seconds.
Hit the like button and subscribe if you want to see more short videos like this.
Thanks for watching, and I will see you in the next

Mở khóa nhiều tính năng hơn

Cài đặt tiện ích Trancy để mở khóa nhiều tính năng hơn, bao gồm phụ đề AI, định nghĩa từ AI, phân tích ngữ pháp AI, nói chuyện AI, v.v.

feature cover

Tương thích với các nền tảng video chính

Trancy không chỉ cung cấp hỗ trợ phụ đề song ngữ cho các nền tảng như YouTube, Netflix, Udemy, Disney+, TED, edX, Kehan, Coursera, mà còn cung cấp dịch từ/câu bằng AI, dịch toàn văn sâu sắc và các tính năng khác cho các trang web thông thường. Đây là một trợ lý học ngôn ngữ đa năng thực sự.

Trình duyệt trên tất cả các nền tảng

Trancy hỗ trợ tất cả các trình duyệt trên tất cả các nền tảng, bao gồm tiện ích trình duyệt iOS Safari.

Nhiều chế độ xem

Hỗ trợ chế độ xem rạp, đọc, kết hợp và các chế độ xem khác để có trải nghiệm song ngữ toàn diện.

Nhiều chế độ luyện tập

Hỗ trợ luyện viết câu, đánh giá nói, trắc nghiệm nhiều lựa chọn, viết theo mẫu và các chế độ luyện tập khác.

Tóm tắt video AI

Sử dụng OpenAI để tóm tắt video và nắm bắt nhanh nội dung chính.

Phụ đề AI

Tạo phụ đề AI chính xác và nhanh chóng trên YouTube chỉ trong 3-5 phút.

Định nghĩa từ AI

Chạm vào từ trong phụ đề để tra cứu định nghĩa, với định nghĩa dựa trên AI.

Phân tích ngữ pháp AI

Phân tích ngữ pháp câu để nhanh chóng hiểu ý nghĩa câu và nắm vững các điểm ngữ pháp khó.

Nhiều tính năng web khác

Ngoài phụ đề song ngữ cho video, Trancy còn cung cấp dịch từ và dịch toàn văn cho các trang web.

Sẵn sàng để bắt đầu

Hãy thử Trancy ngay hôm nay và trải nghiệm các tính năng độc đáo của nó cho chính bạn

Tải về