-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax variation "alpha" #2
Comments
Sorry, been crazy-busy since about the middle of last week, lucky I had time for a few hours of PLAYING Artemis on the weekend, never mind any protocol-nerdery :-) ... and going to continue to be quite busy until later this week too :-( Overall, I like it, I feel like it's coming together, turning into something quite neat, and YES it is getting more readable. It occurs to me though: "enum FrameType", this is "type, space, name". "Everything from "enums.stf" will be in the "enums::" namespace" "There's only colon now", well, and double-colons :-D "only absolute references are allow for now", Did that include "FrameType::shipSystemSync" then? Or should it be "parser::FrameType::shipSystemSync"? 7... C? I think? I could probably be talked into any of them. Oh but hang on, you said "Equals -> Colon" :-p
Come to think of it, I quite like the difference between your "enum" and "flags", and I'd argue an object is a struct where the bitfield attribute is being used as "flags" to pick 0-n optional attributes that follow, and a parser is a struct where the packet-type attribute is being used as an "enum" to pick 1 optional attribute (or SET of attributes, or sub-struct I guess, or something) that follows.
I DO feel like the entire thing is falling FAIRLY neatly into one big compilable parsing-tree though. Definitely heading in a good direction. G'night |
Just a quite note - thanks for the feedback! You're right there's a few things that aren't consistent.. I've been a bit busy too. Keep a look out for the updated version :) |
Thanks again for the feedback. Going over it, I certainly didn't make it easy for anyone to follow what I was saying :D Hope you had time to play Artemis - let's hack some more protocol, when you have time :) I'll try to address your points here:
True, but C-like type definitions are terrible, like kale worship and null pointers ;-)
Yeah, that was a mistake. It uses the key=value syntax now:
I hope this makes sense? btw,
Think of them as keyword arguments. Like in Python, Ruby, and a think a few other languages? It will be parsed to approximately this: ("parser", "SimpleEvent", {"read": "u32"})
Syntactic! Always 4 spaces. Yes, I'll write a proper grammar once we agree on it :) If we want optional whitespace, we need some more syntactic flour. I'm not a fan of braces, but that would be a very traditional way of delimiting sections.
Everything is a value of some sort of another. Right now, there are 3 possible value types:
That's it. This has been enough for everything so far. There are some obvious potential additions, like strings.
Oops, yeah. A lot of "struct"s missing. Fixed :)
Yeah, sorry for the confusion. Should be more consistent now :) So here's the newest syntax and rules:
blocks:
identifiers:
block args:
fields:
values:
reference:
Okay, that's not quite a formal spec, but it should give an idea :) I hope it's easier to follow now? Do you think it's more consistent? |
Here's a few small points - I've been pretty busy but I'll try to do a proper look-through of everything that's changed at some point soon.
Four value types? ;)
Perhaps we could allow files to be 'imported' into blocks, like this?
This would prevent potential name-clashes, however I don't really think that is a particularly big problem. |
FOUR.. our FOUR chief ... I'll come back http://cdn.hitfix.com/photos/6133668/monty-python-spanish-inquisition.jpg :D
That's certainly a tried-and-true way from Python, so I'm not totally against that. I'm not sure the added complexity is worth it for version 1, however. |
This is embarassing, but there was a typo in the branch name :P This is the new link: https://github.com/chrivers/isolinear-chips/tree/syntax-variation-alpha |
As a proof of concept, I implemented an XML parser in version 0.9.4 (just uploaded). It's a bit rough around the edges though, as none of the syntax improvements we are discussing here are implemented, but it should make it easier to see the internal data structure that the templates use :) The syntax is |
(This is an attempt at finalizing the syntax. Going to pull this out of issue #1, so it's easier to follow)
I've made an attempt at cleaning up the syntax for the STF files. Take a look here:
https://github.com/chrivers/isolinear-chips/tree/syntax-varation-alpha
(the compiler doesn't handle it yet.. I don't want to spend time updating it, until we agree somewhat on the syntax)
Here are the changes:
What do you think? This, or something else?
Here are some concrete changes for isolinear chips:
enum<MainScreenView, u32>
syntax is gone! Because we can make references, we now have the simpler form:enums::MainScreenView<u32>
. "enums" in this context means the enums file. This can be checked for validity by the compiler.ships: sizedarray<structs::Ship, 8>
. This, of course, referes to the "structs" file.In general, I think the code is quite a lot easier to read now. It should also be significantly easier to parse and run templates on, since there are many, many fewer special cases. Death to non-generic sections!
ping @NoseyNick @mrfishie - thoughts? ;-)
The text was updated successfully, but these errors were encountered: