Skip to content

Instantly share code, notes, and snippets.

@RobRoseKnows
Last active February 1, 2018 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobRoseKnows/bd07de0059bd0da0b96f1d9253e9a27d to your computer and use it in GitHub Desktop.
Save RobRoseKnows/bd07de0059bd0da0b96f1d9253e9a27d to your computer and use it in GitHub Desktop.
UMBC Math 221 Problems Trello Sync
@{%
const moo = require("moo");
// I'm not bothering to make each of these tokenizers full proof as I'm assuming the input
// will be an actual list of problems.
const lexer = moo.compile({
sectionNum: /[1-9]+\.[0-9]+/,
date: /[0-9]+\/[0-9]+/,
number: /[0-9]+/,
newline: {match: '\n', lineBreaks: true},
comment: /\([A-Za-z0-9\,]+\)/
});
%}
@lexer lexer
Sourcefile -> (Line "\n"):+
Line -> LineLabel "- " LineContents
LineLabel -> Section " " DueDate
Section -> "Section " %sectionNum
DueDate -> "(Due " %date ")"
LineContents -> "#" Problems
Problems -> (Problem ", "):+ Problem
Problem -> RequiredProblem
| NotRequiredProblem
RequiredProblem -> %number "*"
NotRequiredProblem -> %number
Section 1.1 (Due 2/5)- #1, 3*, 4, 5, 6, 7*, 9, 11, 13*, 15, 16*, 17*, 19, 21, 23*, 24*, 25*, 26, 27*, 29, 31*, 33, 34
Section 1.2 (Due 2/5)- #1, 2*, 3, 5, 6*, 7, 9, 11, 13*, 15*, 17, 19*, 21*, 22*, 23, 24, 25, 26, 27*, 28, 29*, 30, 31*, 32
Section 1.3 (Due 2/12)- #1, 3*, 6, 8*, 9, 11, 12*, 13, 15, 17*, 19*, 20, 21*, 22, 23*, 24*, 25*, 27ab, 29, 30*
Section 1.4 (Due 2/12)- #1, 2, 5, 8, 10*, 12*, 13*, 15, 16*, 17, 18*, 21, 23*, 24*, 25, 29*, 30, 31*, 32, 33, 34*
Section 1.5 (Due 2/19)- #2*, 4, 6*, 7, 12*, 13, 14*, 18*, 19, 22*, 23*, 24*, 25, 26*, 27, 30, 32, 36*, 38
Section 1.7 (Due 2/19)- #1, 2*, 4, 5, 6*, 8, 10*, 12, 15, 16, 17, 18, 19*, 20, 21*, 22*, 23, 24*, 25, 26*, 27, 28, 30*, 31, 33, 34, 36*, 38, 39
Section 1.8 (Due 2/26)- #1, 3, 6*, 7, 8, 10*, 12*, 13, 15, 16*, 17, 18*, 19, 20*, 21*, 22*, 24, 25, 26*, 28, 29, 30, 34*
Section 1.9 (Due 2/26)- #1, 4*, 5, 7, 9*, 10, 11, 12*, 13, 15, 16*, 17, 20*, 21, 23*, 24*, 25, 28*, 30*, 35*, 36
Section 2.1 (Due 3/5)- #1, 2, 3, 6, 8, 9*, 10*, 11*, 12*, 15*, 16*, 17, 18, 19*, 20, 22*, 24, 25*, 26, 27, 28*
Section 2.2 (Due 3/5)- #1, 4*, 5, 7*, 8, 9*, 10*, 11, 12*, 13, 14, 16*, 17*, 19, 20*, 21*, 22, 23, 24, 29, 32*
Section 2.3 (Due 3/12)- #1, 2, 3*, 4, 5, 6, 7*, 8, 11*, 12*, 13, 14*, 15, 16*, 17, 18*, 20, 22*, 26, 27*, 28, 29, 30, 33*, 34
Section 4.1 (Due 3/12)- #1*, 2, 3, 5, 7, 8*, 9, 11*, 14*, 15*, 17, 21*, 23*, 24*, 26, 27
Section 4.2 (Due 3/26)- #1, 4, 5*, 9, 11*, 15*, 18, 22*, 25*, 26*, 27*, 28*, 31, 33, 35
Section 4.3 (Due 4/2)- #3, 5, 7, 9*, 11, 13, 14*, 15, 16*, 19*, 21*, 22*, 23, 24*, 26*, 29, 30, 31, 32, 33*, 34*
Section 4.4 (Due 4/2)- #1, 3*, 5, 8*, 9, 11*, 13, 15*, 16*, 17, 18, 21*, 27, 28*, 31*
Section 4.5 (Due 4/9)- #1, 3, 6*, 9, 11, 13, 14*, 19*, 20*, 21*, 23*, 25, 29*, 30, 31*
Section 4.6 (Due 4/9)- #3, 4*, 5, 6*, 7, 10, 11*, 13, 14*, 17*, 18*, 19* (see example 5), 27*
Section 3.1 (Due 4/16)- #3, 6*, 9, 12*, 14*, 19, 20, 21*, 22, 23, 24*, 25, 28*, 30*, 31, 32, 37, 38*, 39*, 40*
Section 3.2 (Due 4/16)- #5, 8, 10*, 11, 14*, 15, 16, 17*, 18, 19, 20*, 23*, 26*, 27*, 28*, 31, 32*, 39, 40*
Section 5.1 (Due 4/16)- #1, 3, 5, 6*, 7*, 9, 12*, 15, 16*, 18, 19*, 21*, 22*, 23*, 24, 25*, 26, 31, 32*
Section 5.2 (Due 4/23)- #3, 5*, 8*, 9, 11, 14*, 15, 17*, 18*, 20, 21*, 22*, 24*, 25 (see example 5, not discussed in class)
Section 5.3 (Due 4/30)- #1, 3*, 4, 5, 6*, 7, 9*, 11, 13*, 16, 20*, 21*, 22*, 23, 24*, 25*, 27, 28*, 31, 32
Section 6.1 (Due 4/30)- #1, 3, 6*, 8, 11*, 14*, 16*, 17, 19*, 20*, 23*, 25, 28*, 29*, 30, 31*
Section 6.2 (Due 5/7)- #5, 6*, 7, 9*, 12*, 13*, 15*, 17*, 19, 23*, 24*, 27*, 28, 31*, 32
Section 6.3 (Due 5/14)- #1*, 3, 6*, 9*, 11, 12*, 14*, 16*, 17*, 19, 21*, 22*, 24*
nearley-unparse problems-grammar.js -o test.txt
Section (Due )- #*, ,
Section (Due )- #, *,
Section (Due )- #*, , , *,
Section (Due )- #*, *
Section (Due )- #*, *, *, *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment