aboutsummaryrefslogtreecommitdiff
path: root/src/bnf-generate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bnf-generate.c')
-rw-r--r--src/bnf-generate.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/bnf-generate.c b/src/bnf-generate.c
new file mode 100644
index 0000000..267dc35
--- /dev/null
+++ b/src/bnf-generate.c
@@ -0,0 +1,41 @@
1#include <stdlib.h>
2#include <stdio.h>
3
4int
5main (void)
6{
7 printf (" <syntax> ::= 'https://docs.google.com/' <type> '/d/' <id> <opt-action> <opt-parameters>\n");
8
9 printf (" <type> ::= 'document' | 'spreadsheet' | 'presentation'\n");
10
11 printf (" <id> ::=");
12 for (int i = 0; i < 33; ++i) {
13 printf (" <id-char>");
14 } printf (" |");
15 for (int i = 0; i < 44; ++i) {
16 printf (" <id-char>");
17 } printf ("\n");
18
19 printf (" <id-char> ::= ");
20 for (char c = '0'; c <= '9'; ++c)
21 printf ("'%c' | ", c);
22 for (char c = 'a'; c <= 'z'; ++c)
23 printf ("'%c' | ", c);
24 for (char c = 'A'; c <= 'Z'; ++c) {
25 printf ("'%c' | ", c);
26 } printf ("'-' | '_'\n");
27
28 printf (" <opt-action> ::= '' | '/' | '/copy' | '/edit' | '/export' | '/view' | '/preview'\n");
29
30 printf (" <opt-parameters> ::= '' | '?' <parameter-chars>\n");
31
32 printf ("<parameter-chars> ::= '' | <parameter-char> <parameter-chars>\n");
33
34 printf (" <parameter-char> ::= ");
35 for (char c = '!'; c <= '~'; ++c) {
36 if (c != '!') printf (" | ");
37 printf (c != '\'' ? "'%c'" : "\"%c\"", c);
38 } printf ("\n");
39
40 return EXIT_SUCCESS;
41}