fusion-lang 0.0.1.alpha2 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -8
  3. data/docs/lang/design.md +240 -51
  4. data/docs/lang/implementation.md +238 -0
  5. data/docs/lang/roadmap.md +20 -36
  6. data/docs/user/explanation.md +5 -10
  7. data/docs/user/how-to-guides.md +60 -15
  8. data/docs/user/reference.md +356 -142
  9. data/docs/user/tutorial.md +21 -19
  10. data/examples/double.fsn +1 -1
  11. data/examples/factorial.fsn +2 -2
  12. data/examples/fizzbuzz.fsn +1 -4
  13. data/examples/json_test.fsn +4 -0
  14. data/examples/palindrome.fsn +1 -1
  15. data/exe/fusion +10 -10
  16. data/lib/fusion/ast.rb +2 -1
  17. data/lib/fusion/cli/decoder.rb +10 -5
  18. data/lib/fusion/cli/options.rb +130 -60
  19. data/lib/fusion/cli/parser.rb +3 -3
  20. data/lib/fusion/cli/repl.rb +30 -25
  21. data/lib/fusion/cli/serializer.rb +5 -4
  22. data/lib/fusion/cli.rb +119 -48
  23. data/lib/fusion/interpreter/builtins.rb +260 -151
  24. data/lib/fusion/interpreter/env.rb +42 -12
  25. data/lib/fusion/interpreter/error_val.rb +42 -20
  26. data/lib/fusion/interpreter/thunk.rb +53 -0
  27. data/lib/fusion/interpreter.rb +239 -82
  28. data/lib/fusion/lexer.rb +69 -3
  29. data/lib/fusion/parser.rb +189 -51
  30. data/lib/fusion/version.rb +1 -1
  31. data/stdlib/all.fsn +13 -0
  32. data/stdlib/any.fsn +12 -0
  33. data/stdlib/chars.fsn +5 -0
  34. data/stdlib/compact.fsn +6 -0
  35. data/stdlib/concat.fsn +5 -0
  36. data/stdlib/falsey.fsn +6 -0
  37. data/stdlib/filter.fsn +12 -0
  38. data/stdlib/flatten.fsn +7 -0
  39. data/stdlib/gt.fsn +9 -0
  40. data/stdlib/gte.fsn +9 -0
  41. data/stdlib/lt.fsn +9 -0
  42. data/stdlib/lte.fsn +9 -0
  43. data/stdlib/map.fsn +6 -4
  44. data/stdlib/range.fsn +2 -2
  45. data/stdlib/reduce.fsn +8 -0
  46. data/stdlib/sanitize.fsn +2 -2
  47. data/stdlib/truthy.fsn +7 -0
  48. metadata +18 -4
  49. data/lib/fusion/interpreter/file_thunk.rb +0 -39
  50. data/stdlib/mapValues.fsn +0 -5
  51. data/stdlib/math/square.fsn +0 -4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusion-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha2
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Klaus Weidinger
@@ -22,6 +22,7 @@ files:
22
22
  - Rakefile
23
23
  - docs/index.md
24
24
  - docs/lang/design.md
25
+ - docs/lang/implementation.md
25
26
  - docs/lang/roadmap.md
26
27
  - docs/user/explanation.md
27
28
  - docs/user/how-to-guides.md
@@ -32,6 +33,7 @@ files:
32
33
  - examples/factorial.fsn
33
34
  - examples/first.fsn
34
35
  - examples/fizzbuzz.fsn
36
+ - examples/json_test.fsn
35
37
  - examples/palindrome.fsn
36
38
  - exe/fusion
37
39
  - lib/fusion.rb
@@ -48,9 +50,9 @@ files:
48
50
  - lib/fusion/interpreter/builtins.rb
49
51
  - lib/fusion/interpreter/env.rb
50
52
  - lib/fusion/interpreter/error_val.rb
51
- - lib/fusion/interpreter/file_thunk.rb
52
53
  - lib/fusion/interpreter/func.rb
53
54
  - lib/fusion/interpreter/native_func.rb
55
+ - lib/fusion/interpreter/thunk.rb
54
56
  - lib/fusion/lexer.rb
55
57
  - lib/fusion/null.rb
56
58
  - lib/fusion/parser.rb
@@ -58,11 +60,23 @@ files:
58
60
  - lib/fusion/typed_data.rb
59
61
  - lib/fusion/version.rb
60
62
  - lib/fusion/wire_pair.rb
63
+ - stdlib/all.fsn
64
+ - stdlib/any.fsn
65
+ - stdlib/chars.fsn
66
+ - stdlib/compact.fsn
67
+ - stdlib/concat.fsn
68
+ - stdlib/falsey.fsn
69
+ - stdlib/filter.fsn
70
+ - stdlib/flatten.fsn
71
+ - stdlib/gt.fsn
72
+ - stdlib/gte.fsn
73
+ - stdlib/lt.fsn
74
+ - stdlib/lte.fsn
61
75
  - stdlib/map.fsn
62
- - stdlib/mapValues.fsn
63
- - stdlib/math/square.fsn
64
76
  - stdlib/range.fsn
77
+ - stdlib/reduce.fsn
65
78
  - stdlib/sanitize.fsn
79
+ - stdlib/truthy.fsn
66
80
  homepage: https://github.com/dunkelziffer/fusion
67
81
  licenses:
68
82
  - MIT
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # === Interpreter internals ===
4
- #
5
- # Lazy, memoized reference to a file's value (a "thunk" / promise).
6
-
7
- module Fusion
8
- class Interpreter
9
- class FileThunk
10
- def initialize(loader, abspath)
11
- @loader = loader
12
- @abspath = abspath
13
- @state = :unforced # :unforced | :forcing | :done
14
- @value = nil
15
- end
16
-
17
- def force
18
- case @state
19
- when :done then @value
20
- when :forcing
21
- # We are already evaluating this file and were asked for it again
22
- # without any intervening function boundary => non-productive data cycle.
23
- ErrorVal.internal(
24
- kind: "reference_error",
25
- location: @loader.file_location(@abspath),
26
- operation: "forcing a file reference",
27
- input: @abspath,
28
- message: "non-productive data cycle"
29
- )
30
- else
31
- @state = :forcing
32
- @value = @loader.evaluate_file(@abspath)
33
- @state = :done
34
- @value
35
- end
36
- end
37
- end
38
- end
39
- end
data/stdlib/mapValues.fsn DELETED
@@ -1,5 +0,0 @@
1
- # Apply f to each value of an object, keeping the keys. Input: {"f": fn, "object": obj}.
2
- (
3
- {"f": f, "object": obj ? @Object} => {"f": (k => [k, [obj, k] | @get | f]), "xs": obj | @keys} | @map | @toObject,
4
- x => !{"kind": "argument_error", "location": "stdlib mapValues.fsn", "operation": "mapValues", "input": x | @sanitize, "message": "expected {\"f\": _, \"object\": _}"}
5
- )
@@ -1,4 +0,0 @@
1
- (
2
- n ? @Integer => [n, n] | @multiply,
3
- x => !{"kind": "type_error", "location": "stdlib square.fsn", "operation": "square", "input": x | @sanitize, "message": "expected an integer"}
4
- )