摘要: 引言 在我学习 vim 的过程中,最具有启发意义的一句话是: vim 其实是一门编程语言 很早之前我就接触过 vim,但是当时 vim 的按键组合和按键的逻辑对我来说很难记忆,再加上 vim 的界面实在太过于复古,于是我就转向了比较现代的文本编辑器。但当我学完 Missing semester 的时 阅读全文
posted @ 2022-07-02 21:55 MartinLwx 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 什么是 semantic actions 当 Parser 处理输入的代码的时候不仅要判断是否语法和句法都正确,还可以执行一些有用的操作,这些操作就叫做 Semantic actions。其实也就是一段代码,一般嵌入在在语法文件的规则里面。那么当 parser 应用这个规则的时候就会执行你设置的这段 阅读全文
posted @ 2022-05-29 23:24 MartinLwx 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 引言 今天又做到了 Leetcode 169. 多数元素 这一道题. 我依稀记得最优的解法叫做什么摩尔投票法. 但是我对它的印象竟然只有这个名字本身了 Orz. 对于这个算法本身倒是忘得一干二净. 于是我打算系统性地学习一下这个算法的原理, 并将它总结出来写成这篇博客. 不知道在哪里看到的一句话 : 阅读全文
posted @ 2022-03-24 21:23 MartinLwx 阅读(303) 评论(0) 推荐(1) 编辑
摘要: Intro 前两个项目还算简单, 比较不复杂. 但是今天这个第三个项目难度确实是上升了(看游戏规则就知道这个有多复杂了). 感觉像是植物大战僵尸 所以我打算为他写一篇博客来整理一下写代码时候的思路. 话不多说, 让我们进入正题吧 ! Phase 1: Basic gameplay Problem 1 阅读全文
posted @ 2022-03-12 14:12 MartinLwx 阅读(7534) 评论(6) 推荐(2) 编辑
摘要: Trees Q1: Prune Min Write a function that prunes a Tree t mutatively. t and its branches always have zero or two branches. For the trees with two bran 阅读全文
posted @ 2022-03-03 20:16 MartinLwx 阅读(530) 评论(0) 推荐(0) 编辑
摘要: BNF Q1: Grouping and Pipes In this question, you will add support for grouping and piping. Recall that grouping allows for an entire regular expressio 阅读全文
posted @ 2022-03-02 21:12 MartinLwx 阅读(1147) 评论(0) 推荐(0) 编辑
摘要: Regular Expressions Q1: Calculator Ops Write a regular expression that parses strings written in the 61A Calculator language and returns any expressio 阅读全文
posted @ 2022-03-02 12:59 MartinLwx 阅读(389) 评论(0) 推荐(0) 编辑
摘要: Q2: Roman Numerals Write a regular expression that finds any string of letters that resemble a Roman numeral and aren't part of another word. A Roman 阅读全文
posted @ 2022-03-02 00:24 MartinLwx 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Context Problem 1 Important: Your code for this part should go in buffer.py. Your job in this part is to implement the current and pop_first methods o 阅读全文
posted @ 2022-03-01 15:18 MartinLwx 阅读(683) 评论(0) 推荐(0) 编辑
摘要: Q1: My Filter Write a procedure my-filter, which takes a predicate func and a list lst, and returns a new list containing only elements of the list th 阅读全文
posted @ 2022-02-28 14:48 MartinLwx 阅读(550) 评论(0) 推荐(0) 编辑