summaryrefslogtreecommitdiffstats
path: root/README.org
blob: 88f41f60719d4f5a073f0a141ec52fdc09ad8a9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#+STARTUP: hidestars

* example
#+begin_src recipe
  # title
  @ fried onion

  ## INGREDIENTS
  # `!/path/to/rcp` to include it
  # `2!/path/to/rcp` to include two of it
  #  `a = b` set ingredient a to quantity b
  onion = 2
  salt = 1tsp
  sugar = 1/2tsp
  butter = 3tbsp

  # sep
  ---

  ## STEPS
  # `-` means preping step
  # `>` means cooking step
  # `+` means serving step
  # in a step you can add a time range in `[]`
  # each step might produce some new ingredients `=>`

  - chop $onion to thin stripes => sliced onion
  > melt $butter in pan
  > add ${sliced onion} and $salt
  > cook while stirring [for 10 minutes]
  > add $sugar
  > continue cooking [until onion caramelises]
  + serve cold
#+end_src

* cmd

  cmd [-switches] path/to/file ...

  I should be able to:
  - list ingredients of recipies (to buy)
  - pretty print steps for recipe (prep/cook/both)
  - search for KEY in ingredients and show availiable recipes with KEY as ingredient
  - should accept multiple keys and a switch for AND or OR between them
    + or a custom syntax like =cmd -s"eggs & (tomatoes | potatoes)" lib/*.rcp=
    + or =cmd -[A|O] -stomatoes -stomatoes -seggs lib/*rcp= (And/Or)
  - *ls* ???
    + list recipies with path
    + or with title
    + or both

* parse
** Input
   Recipe file [[example]]
** Output
   Struct with raw steps and subrecipes

* eval

** Input
   parser output
** Output
   Struct with
   - finalised ingredients
   - resolved steps
   - subrecipes still remain

** EvalSteps

   Step also has:
   - duration :: string or null
   - result? :: string or null
   - variables? :: list of strings or null
   
   #+begin_src C
     struct resolved_step {
       char * text;
       char * duration;
       char * result;
       char ** ingredients;
     }
   #+end_src


* Food compiler

  recipes are text files defined above

  ingredients and results from steps are variables linking back to the quantity or the step that produced them

  the food compiler parses these files into internal C structures, the errors reported are syntax ones

  then they can be eval'd which merges any subrecipe ingredients and steps into one plain recipe

* Test commands to create UX

  #+begin_src bash
    # Common options
    ## -I /path/:/other/path/:~/.path:and/another/relative/one

    # compile a recipe
    # Use it when creating a new recipe to verify it's integridy
    # i.e.
    #   parse the recipe
    #   resolve any includes
    #   merge ingredients
    #   evaluate steps
    #
    # also accepts files from stdin
    recipc [OPTIONS] [FILE...]

    # food
    ## the main program thing
    ## OPTIONS include:
    ### search
    ### list

    ## FILE is
    # A collection of recipes from the library
    # lines are valid food commands (without the executable)
    # that return one or more recipes fro the library
    # Some way to set common options might be needed (-I specifically)
    food [OPTIONS] [FILE]
  #+end_src