Commit Graph

20 Commits

Author SHA1 Message Date
ec443899c3 Builtins start with exclamation point 2023-11-02 16:36:43 +01:00
360857d506 Completely refactor gg with new BNF file and decoder
The new gg format is based on a BNF file which can be found in the `gg`
directory. The code for decoding `.gg` files has been refactored to
mirror that file. The result is more resilient parsing, better errors,
and a greater ability to extend the format in the future.

The new decoder is notable in that it does not use a lexer. Both lexing
and parsing are done in a single step.

The format syntax itself has also been modified. Rather than using
semi-colons everywhere, commas are used as separators in tuples.
Additionally the final comma/semi-colon is no longer required.
2023-10-25 11:32:54 +02:00
Brian Picciano
ebf57591a8 Got basic demo working, ran go fmt 2021-12-30 15:29:38 -07:00
Brian Picciano
223b7f93a5 Implement graph.MapReduce 2021-12-30 13:59:31 -07:00
Brian Picciano
2a96e9a593 Reverse order of args in ValueOut, TupleOut, and AddValueIn
The order of these methods now matches the order of edge/value in every
other context.
2021-12-30 11:38:36 -07:00
Brian Picciano
9c48232ac1 Allow Graph edge and vertex values to be different types
Lots of type aliases in use with `gg` to make this not be a verbose
clusterfuck.
2021-12-30 09:56:20 -07:00
Brian Picciano
c4dd673bf4 Refactor Graph internals to deduplicate OpenEdges
This change required OpenEdges to be passed around as pointers, which in
turn required me to audit how value copying is being done everywhere and
simplify it in a few places. I think I covered all the bases.

The new internals of Graph allow the graph's actual structure to be
reflected within the graph itself. For example, if the OpenEdges of two
ValueIns are equivalent then the same OpenEdge pointer is shared for the
two internally. This applies recursively, so if two OpenEdge tuples
share an inner OpenEdge, they will share the same pointer.

This change is a preliminary requirement for creating a graph mapping
operation. Without OpenEdge deduplication the map operation would end up
operating on the same OpenEdge multiple times, which would be incorrect.
2021-12-29 13:57:14 -07:00
Brian Picciano
181c392219 Cleanup internals of graph a bit
There's no need for the `vertex` type anymore, `OpenEdge` can just hold
its values directly.
2021-12-29 12:55:45 -07:00
Brian Picciano
e7991adfaa Make graph generic
The base graph implementation has been moved into its own package,
`graph`, and been made fully generic, ie the value on each vertex/edge
is a parameterized type. This will allow us to use the graph for both
syntax parsing (gg) and runtime evaluation (vm), with each use-case
being able to use slightly different Value types.
2021-12-29 12:32:53 -07:00
Brian Picciano
3f28c60ab8 Remove a bunch of old code, update the README 2021-08-26 21:25:39 -06:00
Brian Picciano
ad1e99585b graph: refactor Graph into being an interface 2018-10-04 17:33:19 -04:00
Brian Picciano
16f2b1bbde graph: make Edge into an interface 2018-10-04 15:24:17 -04:00
Brian Picciano
a5b3b7acd0 graph: fix TestVisitBreadth test to ensure edge is to a brand new value during a newRank action 2018-10-04 15:02:12 -04:00
Brian Picciano
0fe15409a8 graph: implement VisitBreadth/VisitDepth 2018-09-25 17:26:11 -04:00
Brian Picciano
b51935fcd1 graph: implement Join/Disjoin 2018-09-25 13:58:50 -04:00
Brian Picciano
20b2a80a3c graph: refactor to use Node type 2018-08-21 14:46:17 -04:00
Brian Picciano
9534ff5c13 graph: don't give values to edges, that can be accomplished by a transformation layer later 2018-08-18 14:06:43 -04:00
Brian Picciano
c1bdb46623 graph: implement SubGraph and Equal 2018-08-18 13:51:38 -04:00
Brian Picciano
91c0629377 graph: add edgeIndex's to Graph to speed up EdgeValues call 2018-08-17 11:08:26 -06:00
Brian Picciano
132a50039b graph: implemented smaller and simpler version of gg, which gg can then be built on top of 2018-08-14 16:28:11 -04:00