Commit Graph

17 Commits

Author SHA1 Message Date
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
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
6040abc836 Implementation of a super basic vm
The vm does what it needs to do (evaluate the result of passing an input
to an operatio, where the input and the operation themselves may have
sub-inputs/operations to evaluate), with many caveats/misgivings.
2021-12-29 10:43:08 -07:00
Brian Picciano
3f28c60ab8 Remove a bunch of old code, update the README 2021-08-26 21:25:39 -06:00
Brian Picciano
97f972f287 refactor variable stuff to use fewer op types and be more consistent 2017-02-16 11:37:31 -07:00
Brian Picciano
ea869e7306 write some tests 2017-02-16 10:53:27 -07:00
Brian Picciano
685cde7afb got variable assignment working 2017-02-15 15:41:14 -07:00
Brian Picciano
463d693b17 implement tupElOp and use it in vAsTup 2017-02-15 08:36:23 -07:00
Brian Picciano
c6ce87df84 rename cmd to op in vm 2017-02-15 08:18:19 -07:00
Brian Picciano
3d02b6a591 fix add, clean up main 2017-02-12 11:44:10 -07:00
Brian Picciano
73d81dcbcc refactor to use an interface instead of buildCmd 2017-02-12 11:32:44 -07:00
Brian Picciano
4180e6b072 begin separating types into lang vs vm 2017-02-12 09:53:59 -07:00
Brian Picciano
a5040a6248 attach term Type to values 2017-02-12 08:55:27 -07:00
Brian Picciano
8937201f5c improve how buildCmds are defined 2017-02-11 13:35:02 -07:00
Brian Picciano
54448fda80 taking a new approach using tuples and atoms for compilation, it's working out a lot better 2017-02-11 10:24:02 -07:00