Skip to content

Commit

Permalink
mini spec: Identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Dec 20, 2024
1 parent 7cd282c commit 2ca82b9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ For more details, see [Quick Start](doc/docs.md).
## Key Features of Go+

* Approaching natural language expression and intuitive (see [How Go+ simplifies Go's expressions](#how-go-simplifies-gos-expressions)).
* Smallest but Turing-complete syntax set in best practices (see [Go+ Mini Specification](doc/spec-mini.md)).
* Fully compatible with [Go](https://github.com/golang/go) and can mix Go/Go+ code in the same package (see [Go+ Full Specification](doc/spec.md) and [Go/Go+ Hybrid Programming](doc/docs.md#gogo-hybrid-programming)).
* Smallest but Turing-complete syntax set in best practices (see [The Go+ Mini Specification](doc/spec-mini.md)).
* Fully compatible with [Go](https://github.com/golang/go) and can mix Go/Go+ code in the same package (see [The Go+ Full Specification](doc/spec.md) and [Go/Go+ Hybrid Programming](doc/docs.md#gogo-hybrid-programming)).
* Integrating with the C ecosystem including Python and providing limitless possibilities based on [LLGo](https://github.com/goplus/llgo) (see [Support for C/C++ and Python](#support-for-cc-and-python)).
* Does not support DSL (Domain-Specific Languages), but supports SDF (Specific Domain Friendliness) (see [Go+ Classfiles](#go-classfiles)).

Expand Down Expand Up @@ -81,7 +81,7 @@ Code style is just the first step. We have made many efforts to make the code mo
| OnStart(func() {<br>&nbsp;&nbsp;&nbsp;&nbsp;...<br>}) | onStart => {<br>&nbsp;&nbsp;&nbsp;&nbsp;...<br>} | Lambda expressions |
| type Rect struct {<br>&nbsp;&nbsp;&nbsp;&nbsp;Width&nbsp; float64<br>&nbsp;&nbsp;&nbsp;&nbsp;Height float64<br>}<br><br>func (this *Rect) Area() float64 { <br>&nbsp;&nbsp;&nbsp;&nbsp;return this.Width * this.Height<br>} | var (<br>&nbsp;&nbsp;&nbsp;&nbsp;Width&nbsp; float64<br>&nbsp;&nbsp;&nbsp;&nbsp;Height float64<br>)<br><br>func Area() float64 { <br>&nbsp;&nbsp;&nbsp;&nbsp;return Width * Height<br>} | [Go+ Classfiles](doc/classfile.md): We can express OOP with global variables and functions. |

For more details, see [Go+ Mini Specification](doc/spec-mini.md).
For more details, see [The Go+ Mini Specification](doc/spec-mini.md).


## Support for C/C++ and Python
Expand Down
23 changes: 22 additions & 1 deletion doc/spec-mini.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Go+ Specification for STEM Education
The Go+ Mini Specification
=====

Go+ has a recommended best practice syntax set, which we call the Go+ Mini Specification.It is simple but Turing-complete and can elegantly implement any business requirements.

## Notation

The syntax is specified using a [variant](https://en.wikipedia.org/wiki/Wirth_syntax_notation) of Extended Backus-Naur Form (EBNF):
Expand Down Expand Up @@ -101,6 +103,25 @@ To reflect idiomatic use, code examples in this document elide semicolons using

### Identifiers

Identifiers name program entities such as variables and types. An identifier is a sequence of one or more letters and digits. The first character in an identifier must be a letter.

```go
identifier = letter { letter | unicode_digit } .
```

For example:

```go
a
_x9
ThisVariableIsExported
αβ
```

Some identifiers are [predeclared](#predeclared-identifiers).

### Keywords

TODO

### Integer literals
Expand Down
4 changes: 3 additions & 1 deletion doc/spec.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Go+ Full Specification
The Go+ Full Specification
=====

TODO

## Comments

See [Comments](spec-mini.md#comments).
Expand Down

0 comments on commit 2ca82b9

Please sign in to comment.