Skip to content

Commit

Permalink
Added Rational numbers. Re-named Parser to Projection.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Aug 23, 2023
1 parent b548a7e commit 6620a2a
Show file tree
Hide file tree
Showing 325 changed files with 3,808 additions and 3,397 deletions.
8 changes: 4 additions & 4 deletions licentia/source/program/licentia.lux
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
["[0]" io (.only IO) (.use "[1]#[0]" monad)]
["[0]" maybe]
["[0]" try (.only Try)]
["[0]" parser]
["[0]" projection]
[security
["!" capability]]]
[data
Expand All @@ -36,9 +36,9 @@
["[0]" utf8]]]
[format
["[0]" json (.only)
["<[1]>" \\parser (.only Parser)]]]]
["<[1]>" \\projection (.only Projection)]]]]
["[0]" program (.only program)
["<[1]>" \\parser]]
["<[1]>" \\projection]]
[world
["[0]" file]]]]
["[0]" /
Expand All @@ -63,7 +63,7 @@
(the _
(program [input (<| (<program>.named "--input")
<program>.any)
output (<| (parser.default ..default_output_file)
output (<| (projection.default ..default_output_file)
(<program>.named "--output")
<program>.any)]
(do io.monad
Expand Down
34 changes: 17 additions & 17 deletions licentia/source/program/licentia/input.lux
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
[monad (.only do)]]
[control
["[0]" exception (.only Exception)]
["<>" parser]]
["<>" projection]]
[data
[text
["%" \\format (.only format)]]
[format
["[0]" json
["<[1]>" \\parser (.only Parser)]]]]
["<[1]>" \\projection (.only Projection)]]]]
[math
[number
["n" nat]
Expand All @@ -35,7 +35,7 @@
["[0]" copyright]]])

(the identification
(Parser Identification)
(Projection Identification)
(<json>.object
(all <>.and
(<json>.field "name" <json>.string)
Expand All @@ -52,7 +52,7 @@
)

(the amount
(Parser Nat)
(Projection Nat)
(do <>.monad
[amountF <json>.number
#let [amountI (d.int amountF)]
Expand All @@ -70,7 +70,7 @@
["End" (%.nat (its time.#end period))])))

(the period
(Parser (Period Nat))
(Projection (Period Nat))
(<json>.object
(do <>.monad
[start (<json>.field "start" ..amount)
Expand All @@ -82,44 +82,44 @@
(wrap period))))

(the copyright_holder
(Parser copyright.Holder)
(Projection copyright.Holder)
(<json>.object
(all <>.and
(<json>.field "name" <json>.string)
(<json>.field "period" ..period))))

(the termination
(Parser Termination)
(Projection Termination)
(<json>.object
(all <>.and
(<json>.field "patent retaliation?" <json>.boolean)
(<json>.field "termination period" ..amount)
(<json>.field "grace period" ..amount))))

(the liability
(Parser Liability)
(Projection Liability)
(<json>.object
(all <>.and
(<json>.field "can accept?" <json>.boolean)
(<json>.field "disclaim high risk?" <json>.boolean))))

(the distribution
(Parser Distribution)
(Projection Distribution)
(<json>.object
(all <>.and
(<json>.field "can re-license?" <json>.boolean)
(<json>.field "can multi-license?" <json>.boolean))))

(the commercial
(Parser Commercial)
(Projection Commercial)
(<json>.object
(all <>.and
(<json>.field "can sell?" <json>.boolean)
(<json>.field "require contributor credit?" <json>.boolean)
(<json>.field "allow contributor endorsement?" <json>.boolean))))

(the extension
(Parser Extension)
(Projection Extension)
(<json>.object
(all <>.and
(<json>.field "same license?" <json>.boolean)
Expand All @@ -128,22 +128,22 @@
(<json>.field "must describe modifications?" <json>.boolean))))

(the entity
(Parser Entity)
(Projection Entity)
<json>.string)

(the black_list
(Parser Black_List)
(Projection Black_List)
(<json>.object
(all <>.and
(<json>.field "justification" (<json>.nullable <json>.string))
(<json>.field "entities" (<json>.array (<>.many ..entity))))))

(the url
(Parser URL)
(Projection URL)
<json>.string)

(the attribution
(Parser Attribution)
(Projection Attribution)
(<json>.object
(all <>.and
(<json>.field "copyright-notice" <json>.string)
Expand All @@ -152,14 +152,14 @@
(<json>.field "image" (<json>.nullable ..url)))))

(the addendum
(Parser Addendum)
(Projection Addendum)
(<json>.object
(all <>.and
(<json>.field "commons clause?" <json>.boolean)
)))

(the .public license
(Parser License)
(Projection License)
(<json>.object
(all <>.and
(<json>.field "copyright-holders" (<json>.array (<>.many ..copyright_holder)))
Expand Down
2 changes: 1 addition & 1 deletion lux-r/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[syntax (.only syntax)]
["[0]" template]
["[0]" code (.only)
["<[1]>" \\parser]]]
["<[1]>" \\projection]]]
[math
[number (.only hex)
["n" nat]
Expand Down
2 changes: 1 addition & 1 deletion lux-r/source/test/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[lux (.except)
[control
["[0]" io]
[parser
[projection
[cli (.only program)]]]
[test
["_" property (.only Test)]]]]
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/documentation/lux/control.lux
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
["[1][0]" io]
["[1][0]" lazy]
["[1][0]" maybe]
["[1][0]" parser]
["[1][0]" projection]
["[1][0]" pipe]
["[1][0]" scope]
["[1][0]" region]
Expand All @@ -40,7 +40,7 @@
/io.documentation
/lazy.documentation
/maybe.documentation
/parser.documentation
/projection.documentation
/pipe.documentation
/scope.documentation
/region.documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
($.definition /.apply)
($.definition /.monad)

($.definition (/.Parser state it)
"A generic parser.")
($.definition (/.Projection state it)
"A generic projection.")

($.definition /.assertion
"Fails with the given message if the test is #0."
($.example (' (assertion message test))))

($.definition /.maybe
"Optionality combinator."
($.example (' (maybe parser))))
($.example (' (maybe projection))))

($.definition /.value
(format "Executes the parser on the input."
\n "Does not verify that all of the input has been consumed by the parser."
\n "Returns both the parser's output, and a value that represents the remaining input.")
($.example (' (value parser input))))
(format "Executes the projection on the input."
\n "Does not verify that all of the input has been consumed by the projection."
\n "Returns both the projection's output, and a value that represents the remaining input.")
($.example (' (value projection input))))

($.definition /.and
"Sequencing combinator."
Expand All @@ -51,81 +51,81 @@

($.definition /.some
"0-or-more combinator."
($.example (' (some parser))))
($.example (' (some projection))))

($.definition /.many
"1-or-more combinator."
($.example (' (many parser))))
($.example (' (many projection))))

($.definition /.exactly
"Parse exactly N times."
($.example (' (exactly amount parser))))
($.example (' (exactly amount projection))))

($.definition /.at_least
"Parse at least N times."
($.example (' (at_least amount parser))))
($.example (' (at_least amount projection))))

($.definition /.at_most
"Parse at most N times."
($.example (' (at_most amount parser))))
($.example (' (at_most amount projection))))

($.definition /.between
""
($.example (' (between minimum additional parser))))
($.example (' (between minimum additional projection))))

($.definition /.separated_by
"Parses instances of 'parser' that are separated by instances of 'separator'."
($.example (' (separated_by separator parser))))
"Parses instances of 'projection' that are separated by instances of 'separator'."
($.example (' (separated_by separator projection))))

($.definition /.not
"Only succeeds when the underlying parser fails."
($.example (' (not parser))))
"Only succeeds when the underlying projection fails."
($.example (' (not projection))))

($.definition /.failure
"Always fail with this 'message'."
($.example (' (failure message))))

($.definition /.of_try
"Lift a potentially failed computation into a parser."
"Lift a potentially failed computation into a projection."
($.example (' (of_try operation))))

($.definition /.else
"If the given parser fails, returns the default value."
($.example (' (else value parser))))
"If the given projection fails, returns the default value."
($.example (' (else value projection))))

($.definition /.remaining
"Yield the remaining input (without consuming it).")

($.definition /.rec
"Combinator for recursive parsers."
($.example (' (rec parser))))
"Combinator for recursive projections."
($.example (' (rec projection))))

($.definition /.after
"Run the parser after another one (whose output is ignored)."
"Run the projection after another one (whose output is ignored)."
($.example (' (after param subject))))

($.definition /.before
"Run the parser before another one (whose output is ignored)."
"Run the projection before another one (whose output is ignored)."
($.example (' (before param subject))))

($.definition /.only
"Only succeed when the parser's output passes a test."
($.example (' (only test parser))))
"Only succeed when the projection's output passes a test."
($.example (' (only test projection))))

($.definition /.parses?
"Ignore a parser's output and just verify that it succeeds."
($.example (' (parses? parser))))
"Ignore a projection's output and just verify that it succeeds."
($.example (' (parses? projection))))

($.definition /.parses
"Ignore a parser's output and just execute it."
($.example (' (parses parser))))
"Ignore a projection's output and just execute it."
($.example (' (parses projection))))

($.definition /.speculative
(format "Executes a parser, without actually consuming the input."
\n "That way, the same input can be consumed again by another parser.")
($.example (' (speculative parser))))
(format "Executes a projection, without actually consuming the input."
\n "That way, the same input can be consumed again by another projection.")
($.example (' (speculative projection))))

($.definition /.codec
"Decode the output of a parser using a codec."
($.example (' (codec codec parser))))
"Decode the output of a projection using a codec."
($.example (' (codec codec projection))))
))
Loading

0 comments on commit 6620a2a

Please sign in to comment.