chrivers / chrivers/transwarp

Syntax variation "alpha"

Open
#2 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

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:
1. Namespaces are a thing now! Every field in an STF project can now be references with a unique name.
2. File names are used now! Everything from "enums.stf" will be in the "enums::" namespace.
3. Equals -> Colon. There's only colon now
4. Any node in the tree can be references. To make the parser simpler, only absolute references are allow for now.
5. 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.
6. 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)
7. 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:
1. "ClientPacket" and "ServerPacket" no longer exist - every packet type is now a struct.
2. The `enum` syntax is gone! Because we can make references, we now have the simpler form: `enums::MainScreenView`. "enums" in this context means the enums file. This can be checked for validity by the compiler.
3. This change also helps the other types: `ships: sizedarray`. 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? ;-)

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the syntax-varation-alpha branch and the existing STF parser/compiler to understand the proposed namespace, reference, type, and packet syntax. The issue is still seeking agreement on alternatives, so there is no defined implementation target or completion test yet.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.