Published on Sunday, October 8th, 2017
A part of my senior project is to create a framework to allow users to use their own grammar in Pyret. A good framework would need to prohibit ambiguous grammar that users might write.
One way to do this would be to require users to write a grammar that is accepted by LALR parser generator, since LALR parser generator will result in a conflict when the grammar is ambiguous. Note that the converse is not true: there could be conflict while the grammar is not ambiguous. This is exactly the situation that we are in because Pyret is currently using GLR parser generator which accept all context-free grammars. And Pyret does have some grammar that require unbounded and non-local lookahead, so LALR is not directly applicable.
There are two solutions that I am considering:
- Rewrite Pyret grammar so that it can be accepted by LALR parser generator. This doesn’t seem applicable since Pyret is widely use by a lot of people
- Use PEG
PEG at first glance seems really nice: linear time parsing, unambiguous by construction, and pretty expressive. However, I found that it could be very deceptive as well.
Published on Thursday, October 5th, 2017
Y combinator seems to be something mysterious. Several people have been trying to understand the intuition why it works. I have seen "A Lecture on the Why of Y" by Matthias Felleisen before, and while it does give me some insight, I still feel confused in some degree. That doesn’t prevent me from recommending this lecture to other people I talked to because it’s the best one I have seen so far.
Recently I thought about the fixed point combinator again and finally gained some good insight. I think it’s worth sharing here.
Published on Saturday, February 25th, 2017
Jack showed this the rules for password naming in a website to me. Here’s an excerpt:
- The password must be exactly 8 characters long.
- It must contain at least one letter, one number, and one of the following special characters.
- The only special characters allowed are: @ # $
- A special chaacter must not be located in the first or last position.
- Two of the same characters sitting next to each other are considered to be a “set.” No “sets” are allowed. Example: rr, tt
- Avoid using names, such as your name, user ID, or the name of your company or employer.
- Other words that cannot be used are Texas, child, and the months of the year.
A new password cannot be too similar to the previous password.
- Example: previous password - abc#1234; unacceptable new password - acb$1243
- Characters in the first, second, and third positions cannot be identical. (abc*****)
- Characters in the second, third, and fourth positions cannot be identical. (*bc#****)
- Characters in the sixth, seventh, and eighth positions cannot be identical. (*****234)
- A password can be changed voluntarily (no Help Desk assistance needed) once in a 15-day period. If needed, the Help Desk can reset the password at any time.
- The previous 8 passwords cannot be reused.
One way to create a password is creative spelling and substitution. Examples:
Published on Wednesday, February 1st, 2017
In this post, I will write about three kinds of inductions: weak induction, strong induction, and structural induction. I in fact dislike these terms because, as I will show below, they are equivalent. Personally, when I think of induction, I will default to the structural induction. Last semester I took a logic class, and they introduce these terms, and also “formula induction”, “proof induction”, “term induction”, “sequence induction”, etc. I was like: *sigh* THEY ARE THE SAME WHY DO YOU NEED DIFFERENT NAMES.
Anyway, for the sake of this article, we will do use these terms for clarity and show the following.
Published on Friday, January 6th, 2017
One of my friends who is a non-CS concentrator would like to scrape emails of all faculties listed in this website. Unfortunately, the emails are not on the page itself, but are on subpages. It would take forever to scrape the data by hand, so I helped. To do this, I need to send multiple requests to scrape each subpage. Naively, we would send a request, wait for a response, then repeat until we go over all list of faculties. This however would take a lot of time. We can do better by sending requests asynchronously. This is feasible because there is no dependency in the data.
Published on Tuesday, January 3rd, 2017
I tried to learn continuations yesterday. This led me to a tutorial for composable continuations in schemewiki.org. It explains things nicely, but what really intrigues me is something completely different: the colorful syntax highlight for nested parentheses when hovering cursor over them.
This post, of course, explains how I managed to get it on my website!
Published on Sunday, January 1st, 2017
Published on Tuesday, December 27th, 2016
Wandering around in Wikipedia yesterday, I found this article: Lemmings. Though I never play this game before, I have played its open-source clone, Pingus, which is really enjoyable. This post is written to pay tribute to this wonderful game.
Published on Monday, December 26th, 2016
Published on Thursday, December 22nd, 2016
Ahem. This is my 7th attempt to write a blog... Hopefully it’s not gonna fail like last time!
In the previous attempts, I hosted my blog with blog sites such as Wordpress or Blogspot. For this time, as you can see, I host it in my own website (powered by Github Pages), so it will (hopefully) be different!
And, you see, the blog content is not that important. The most crucial thing is to get the technology right. What I’m using right now is called Pollen markup, which is pretty much a domain-specific language based on Racket’s @-syntax. Pollen sets up a server which recompiles files automatically whenever it detects file changes. The markup itself is very cool in a sense that you just write whatever you want to write with arbitrary made-up semantics tags, which is very pleasant to write using the said syntax. Then, you can go back and define and format what those tags are supposed to be. The programming part is equally pleasant because it has X-Expression which is a cool version of XML. Pollen supports outputting multiple targets: LaTeX,
html, plain text, or whatever you want to output. Basically, you program the document, so you have an unlimited power to do whatever you want.
Published on Thursday, December 22nd, 2016
I switched from Ubuntu to Macbook Pro since 2013 and was very happy with it. About 5 months ago, the screen was broken, so I planned to buy a new one. Knowing that the new version will have a major change, I was very excited and decided to wait until it’s released in order to buy it. To my disappointment, it incredibly sucks.
A lot of my friends suggested me to get a Thinkpad X1 Yoga which looks really cool. I waited until Thanksgiving to get a big discount. The laptop arrived in early December. The first thing I did is to install Ubuntu 16.10 because I hate Windows!
Following are my settings. I write these particularly for myself in the future so that when I need to set things up again, I won’t have to spend a lot of time figuring out what to do!
Published on Sunday, May 11th, 2014
This post is migrated from my old blog.