-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
(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:
- Namespaces are a thing now! Every field in an STF project can now be references with a unique name.
- File names are used now! Everything from "enums.stf" will be in the "enums::" namespace.
- Equals -> Colon. There's only colon now
- Any node in the tree can be references. To make the parser simpler, only absolute references are allow for now.
- The reference rules are simple: Any identifier that contains "::" is an absolute reference, and will be validated at compile-time. Everything else is a primitive type name.
- Types are also fairly simple. A type (the right-hand side of any section), can be either A) a literal value (ints, typically), B) an identifier (reference or not), or C) type with parameter (sizedarray<foo, 8>)
- Sections should be able to have named values associated with them. Here's a couple of ideas for syntax:
A:
object Creature(bitmask=3)
....
B:
!bitmask=3
object Creature
....
C:
object Creature
!bitmask = 3
What do you think? This, or something else?
Here are some concrete changes for isolinear chips:
- "ClientPacket" and "ServerPacket" no longer exist - every packet type is now a struct.
- The
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. - This change also helps the other types:
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? ;-)
Metadata
Metadata
Assignees
Labels
No labels