James Shubin
4b0cdf9123
lang: types, engine: graph: Support pointer interfaces
...
If we have rare, but special *interface{} values in resource structs, we
should be able to handle them normally. It's really not recommended that
you use these unless you know exactly why they are useful.
2023-11-18 13:35:52 -05:00
James Shubin
1c9fdc79c0
engine: util: Add a workaround for printing special resources
...
This let's our tests compare strings of interface fields!
2023-11-18 13:35:52 -05:00
James Shubin
90d04990ca
engine, lang: Add an AST test that looks at fields too
...
This gives us more options for testing when we need those kinds of more
extensive resource examination features.
2023-11-18 13:35:52 -05:00
James Shubin
aa001ed2dc
engine: graph: Improve error message for rare case
...
Not sure if we ever hit this, but we should fix it up since I noticed
it.
2023-11-18 13:35:52 -05:00
James Shubin
ce1c37dbca
lang: Rename a var for consistency
...
This is going to get used by a future package.
2023-11-15 17:55:47 -05:00
James Shubin
3a3bc568b3
engine: Allow more send/recv cases
...
This allows the other part of this. This still needs to be improved, but
it unblocks some use-cases.
2023-11-12 17:50:07 -05:00
James Shubin
b048b2684b
engine, lang: Allow resources with a field of type interface
...
This lets us add a resource that has an implementation with a field
whose type is determined at compile time. This let's us write more
flexible resources.
What's missing is additional type checking so that we guarantee that a
specific resource doesn't change types during run-time.
2023-11-12 17:25:03 -05:00
James Shubin
9a1a81925e
engine: Improve error messages for ambiguity
...
This appears twice, make each one unique.
2023-11-12 17:09:50 -05:00
James Shubin
e38f3cc12c
lang: types: Let the fancy TypeOf method match interfaces
...
This adds the functionality to match on interface kinds.
2023-11-12 16:14:38 -05:00
James Shubin
4fb356b19b
engine: graph: Refactor the send/recv code to inline it
...
This is useful subsequently.
2023-11-12 16:13:04 -05:00
James Shubin
cb6b8a9670
engine: util: Refactor code for future changes
...
This makes things a bit cleaner and easier to follow and accepts future
patches easier.
2023-11-12 15:26:44 -05:00
James Shubin
efc5237265
lang: types: Improve error handling of value code
...
We can give a bit more feedback and try and also catch a rare scenario.
2023-11-12 15:24:16 -05:00
James Shubin
cb999af653
engine: Improve debugging for invalid send/recv res
...
If we don't implement send/recv properly, at least give the user more
information as to where.
2023-11-12 15:21:08 -05:00
James Shubin
8d7d2fb1f1
engine: resources: Add missing struct tags for password res
...
Just noticed these.
2023-11-04 16:59:09 -04:00
James Shubin
eaff060bf9
lang: ast: Add missing backtick
...
Purely a formatting fix.
2023-11-04 16:57:41 -04:00
James Shubin
6cc5adcd25
lang, test, examples: lang: Use new syntax for structlookup
...
Sugar makes the world go round.
2023-11-04 14:52:19 -04:00
James Shubin
233625db20
lang: parser: Lexer should allow in keyword as a variable name
...
We move it downwards to allow this case. Whether we want to allow this
long-term or not is to be decided.
2023-11-04 14:37:19 -04:00
James Shubin
96093984e4
test, examples: lang: Add new syntax for map lookup
...
Sugar at last!
2023-10-17 15:32:13 -04:00
James Shubin
ea0af4dc43
lang: parser: Add lookup functions to lexer/parser
...
This seems to make things work. I'm worried I might have an ordering bug
where we might choose the wrong precedence if we write ambiguous code
somehow, but at least for now, let's commit this and move on. Hopefully
the nonassoc stuff is actually correct.
2023-10-17 15:21:18 -04:00
James Shubin
8fa5241a13
lang: funcs: Add struct lookup with an optional field
...
This adds an interesting version of the struct lookup function. In the
situation where we can't type-check the field name, it will use the
optional value passed in. This makes it easy to write a function that
will pull in the desired value, even as the input struct changes type
between compilations, without having to re-write your code.
It's structurally different from the other default lookup functions,
which is why it is named differently.
2023-10-17 15:21:18 -04:00
James Shubin
e38eb43955
lang: funcs: Add core lookup functions
...
These versions don't take defaults and instead return the zero value if
there is an issue.
2023-10-17 15:21:18 -04:00
James Shubin
3b46e88734
lang: types: Improve docs for New and initialize the list
...
If we use this to generate a zero value, we want to make sure it's
completely initialized in case we use it subsequently. We also improve
the docs at the same time.
2023-10-17 15:21:18 -04:00
James Shubin
d6a58f33f3
lang: funcs: Add lookup default func for list or map
...
This version requires you specify the default value.
2023-10-17 15:21:18 -04:00
James Shubin
d1c15bd0b7
lang: funcs: Rename the lookup functions
...
This will make things more consistent with future use.
2023-10-17 15:21:18 -04:00
James Shubin
1dc6ebbffc
lang: funcs: Fix one small typo and one small logic bug
...
I don't think the logic bug had any negative effect, but let's be safe.
2023-10-17 15:21:18 -04:00
James Shubin
ee1e07f3d7
lang: funcs: Rename T2 to T3 for future consistency
...
This makes things more symmetrical with the maplookup function.
2023-10-17 15:21:18 -04:00
James Shubin
9e7b7fbb3a
lang: parser: Define variable identifier in the parser
...
Instead of in the lexer. I think this simplifies things and gives the
parser more information which should hopefully make it easier to parse
without shift/reduce conflicts.
2023-10-17 15:21:18 -04:00
James Shubin
04fd330733
test: Improve parser indentation test
...
We need to be fancier with our regexp now that pipes are in the grammar.
Don't match them in comments of course!
2023-10-17 15:21:18 -04:00
James Shubin
361b671799
lang: Clean up test
2023-10-11 17:56:25 -04:00
James Shubin
b8f8ec8aa3
lang: parser, funcs: Take out the built-in history function
...
It's a normally named function for now, until we think of a common
package to move it into.
Hopefully this makes improving the lexer and parser easier for now. We
can consider bringing it back if needed.
2023-10-09 17:19:08 -04:00
James Shubin
05d570d250
lang: parser, funcs: Change the logical operators to OR, AND, NOT
...
This makes it easier to read for some, and easier to parse for us. This
also frees up more characters to use elsewhere.
2023-10-09 17:19:08 -04:00
James Shubin
e8f11286dc
lang: parser: Sort things in the standardized order
...
Nitpick fix.
2023-10-09 17:16:06 -04:00
James Shubin
48bc5637a0
misc: Add the mcl type to ackrc for ack users
...
Now you can `ack --type=mcl` to find .mcl files!
2023-10-09 16:43:50 -04:00
Samuel Gélineau
7bfbe264c7
authors: Adding myself to the authors file
2023-10-07 12:50:19 -04:00
James Shubin
e37876afec
engine: resources: Small formatting cleanups
2023-10-07 11:44:47 -04:00
James Shubin
02153356de
lang: funcs: core: net: Tidy up test
2023-10-03 18:45:17 -04:00
James Shubin
a686c5f9aa
lang: parser: Add new tests for deeper modules
...
You can have a module that's nested two deep or more.
2023-10-03 16:36:37 -04:00
James Shubin
ab7eb0a293
util: password: Reverse the nonblocking stdin
...
It's not clear if this is absolutely necessary or not, but it probably
doesn't hurt. It's not clear if there is a way to read the previous
state before running this. Of course this isn't really thread-safe, so
use at your own risk.
2023-09-29 22:13:14 -04:00
James Shubin
738485a655
etcd: Add world API changes for watching member status
...
This adds some useful functionality so that anyone with access to the
world API, can learn information about the changing etcd cluster it's
using.
2023-09-29 20:46:36 -04:00
James Shubin
0c751ea14f
etcd: util: Move etcd utils into separate package
2023-09-29 20:46:36 -04:00
James Shubin
01f249d484
util: password: Add a cancellable ReadPassword style functions
...
It was non-trivial to do this, so I put it into a library. Strangely I
couldn't directly wrap the ReadPassword function from the
golang.org/x/term package, as it wouldn't unblock for some reason.
2023-09-29 20:46:36 -04:00
James Shubin
53f9f35233
docs: Misc fixes
0.0.24
2023-09-25 18:53:54 -04:00
James Shubin
9a890c7625
misc: More script notes added
2023-09-25 18:53:51 -04:00
James Shubin
2bc23c468e
lang: funcs: core: iter: Finish map function
...
This was the goal all along. Proper iteration without for loops.
Yay!
Co-authored-by: Samuel Gélineau <gelisam@gmail.com >
2023-09-25 18:53:31 -04:00
James Shubin
6e1cde815c
lang: ast: Implement lambdas
...
This is a big giant patch that implements the AST part of lambdas!
I don't know how Sam is able to understand the AST so well, but he does,
and we're all grateful for it. Most of this code was written by him.
Co-authored-by: Samuel Gélineau <gelisam@gmail.com >
2023-09-25 18:52:26 -04:00
James Shubin
d1f1ed8957
lang: funcs: simple, simplepoly, operator: Misc fix ups for lambdas
...
These core functions need some small fixups to bring us up to our
lambdas branch.
Co-authored-by: Samuel Gélineau <gelisam@gmail.com >
2023-09-25 18:52:05 -04:00
James Shubin
a1a23b66c8
lang: funcs: structs: Core function struct modifications
...
These changes are needed for the lambdas implementation.
Co-authored-by: Samuel Gélineau <gelisam@gmail.com >
2023-09-25 18:51:51 -04:00
James Shubin
b4a8d0d783
lang: interfaces, ast: Add debug methods for graphing scope
...
This can occasionally help in our debugging of the scope graph.
Co-authored-by: Samuel Gélineau <gelisam@gmail.com >
2023-09-25 18:51:33 -04:00
James Shubin
fcc76809e3
lang: interfaces: API changes for lambdas
...
Co-authored-by: Samuel Gélineau <gelisam@gmail.com >
2023-09-25 18:51:25 -04:00
James Shubin
1eae5cf272
lang: interfaces: Remove indexes
...
These indexes might be useful later, but they are currently not used.
2023-09-25 18:51:22 -04:00