Here is the lexer description file:
[a-zA-Z_]\w* identifier
\d+ integer
\+ ADD
\- SUBTRACT
| """ | |
| Finds optimal strategy for gambling chip game. | |
| Problem: two players (Alice and Bob) play a game where gambling chips (with | |
| numeric values) are laid out in a line. They alternate turns. During their | |
| turn, a player picks up a chip on either end of the line, but not from anywhere | |
| in the middle, and adds that chip to their collection. At the end, the player | |
| with the higher valued collection of chips wins. | |
| This is a dynamic programming algorithm for solving the problem. It runs in |
| language: python | |
| python: | |
| - 3.5 | |
| install: | |
| - pip install sphinx sphinx_rtd_theme | |
| script: make html | |
| after_success: | |
| - ./push.sh | |
| env: | |
| global: |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| struct node { | |
| int value; | |
| struct node *next; | |
| }; | |
| void ll_print(struct node *list) | |
| { |
| """Embed your most feature rich REPL.""" | |
| _embed_banner = '\n* BREAKPOINT: {filename}:{line}\n* Ctrl+D to continue...' | |
| def _embed_ptipython(): | |
| """ | |
| Embed a ptpython prompt using IPython. | |
| PTPython has an IPython module supporting the exact same embedding API as |
| /***************************************************************************//** | |
| @file sleepsort.c | |
| @author Stephen Brennan | |
| @date Wednesday, 1 July 2015 | |
| @brief C Sleep Sort Implementation. |
Sometimes I want to make a quick web search, and I’d prefer not to leave
Emacs. Sure, I could switch over to a different workspace and open a browser,
but I’d much rather do it in Emacs if possible. eww will let you search
instead of enter a URL, but you only get one search engine (which is, by
default, Duck Duck Go). I’m used to the wonderful interface of Chrome, which
allows you to use a keyword to specify your search engine, right within the
“Omnibox”. Anything else feels crude. So, I decided I would implement my own
search solution!
| #!/bin/sh | |
| # Pacman Mirrorlist Updater | |
| # Stephen Brennan <[email protected]> | |
| # Display help. | |
| if [ "$1" = "-h" -o "$1" = "--help" ]; then | |
| echo "usage: newmirrors" | |
| echo "All-in-one utility for dealing with pacman mirrorlist updates." | |
| echo | |
| echo "Steps:" |
| % m_state for while | |
| m_state([while, C, B], S, S0) :- m_boolean(C, S), !, | |
| m_state(B, S, S1), | |
| m_state([while, C, B], S1, S0). | |
| m_state([while, _, _], S, S). | |
| % m_state for assignment | |
| m_state([L, =, R], S, S0) :- remove_binding(L,S,S1), | |
| m_value(R,S,V), |
| (define curryn | |
| (lambda (func n) | |
| (((lambda (f) (f f)) | |
| (lambda (f) | |
| (lambda (function remaining args) | |
| (if (zero? remaining) | |
| (apply function args) | |
| (lambda (v) | |
| ((f f) function (- remaining 1) (cons v args))))))) | |
| func n '()))) |