- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 LLVM学习(第二章 implementing a parser and AST)
第二章介绍这章主要介绍如何使用词法分析器(Lexer),为K语言建立一个 parser。一旦有了parser,我们可以来定义自己的AST(Abstract Syntax Tree)。parser通过 Recursive Descent Parsing 和 Operator-Precedence Parsing 来分析K语言。----> 递归解析和操作服优先级解析。The Abstract Syntax Tree对于K语言,有表达式、类型、函数原型,初始代码如下:/// ExprAST
2022-04-16 19:32:03 169 1
原创 LLVM 学习(第一章)
LLVM 学习 (第一章 词法分析器)最近想丰富下自己的知识体系,学习学习编译器相关知识。首先从LLVM入手吧。LLVM有官方教学课程,链接为:https://llvm.org/docs/tutorial/本文档仅作为个人学习相关记录。LLVM教程会设计一个名为“Kaleidoscope” 的过程语言。这个语言支持 if/then/else,for,while循环以及 仅支持double数据类型。1.2 The Lexer首先是K语言的词法分析器。词法分析器就是将输入转化为“token”,每个“
2022-04-16 15:59:21 524
原创 Validate Stack Sequences
Validate Stack Sequences题目描述:Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of a sequence of push and pop operations on an initially empty stack, or false otherwise.例子:Input: pushed
2022-03-16 23:55:20 121
原创 Binary Search
1、题目描述:Given an array of integersnumswhich is sorted in ascending order, and an integertarget, write a function to searchtargetinnums. Iftargetexists, then return its index. Otherwise, return-1.You must write an algorithm withO(log n)runti...
2022-03-03 00:13:05 303
原创 leetcode 旋转数组
1、 题目: Rotate ArrayGiven an array, rotate the array to the right by k steps, where k is non-negative.Constraints:1 <= nums.length <= 105-231 <= nums[i] <= 231 - 10 <= k <= 1052、解答class Solution {public: void rotate(vector<i
2022-02-28 23:56:54 236
原创 Longest Common Subsequence
题目描述:Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0.A subsequence of a string is a new string generated from the original string with some characters (can be none) d
2022-02-28 23:13:31 216
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人