From 63b7dff129773e6b50ffa9de7640bd377b2ec64f Mon Sep 17 00:00:00 2001 From: xushiwei Date: Sat, 21 Dec 2024 08:15:26 +0800 Subject: [PATCH] mini spec: Keywords --- README.md | 6 +++--- doc/spec-mini.md | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5c770dc85..6c5207fef 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ For more details, see [Quick Start](doc/docs.md). * 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 [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)). +* Integrating with the C ecosystem including Python and providing limitless possibilities based on [LLGo](https://github.com/goplus/llgo) (see [Importing C/C++ and Python libraries](#importing-cc-and-python-libraries)). * Does not support DSL (Domain-Specific Languages), but supports SDF (Specific Domain Friendliness) (see [Go+ Classfiles](#go-classfiles)). @@ -84,7 +84,7 @@ Code style is just the first step. We have made many efforts to make the code mo For more details, see [The Go+ Mini Specification](doc/spec-mini.md). -## Support for C/C++ and Python +## Importing C/C++ and Python libraries Go+ can choose different Go compilers as its underlying support. Currently known supported Go compilers include: @@ -118,7 +118,7 @@ go 1.21 // llgo 1.0 require github.com/goplus/llgo v0.9.8 ``` -Based on LLGo, Go+ can support importing libraries written in C/C++ and Python. +Based on LLGo, Go+ can import libraries written in C/C++ and Python. Here is an example (see [chello](demo/_llgo/chello/hello.gop)) of printing `Hello world` using C's `printf`: diff --git a/doc/spec-mini.md b/doc/spec-mini.md index 5e458161c..eba5d6a7f 100644 --- a/doc/spec-mini.md +++ b/doc/spec-mini.md @@ -122,6 +122,18 @@ Some identifiers are [predeclared](#predeclared-identifiers). ### Keywords +The following keywords are reserved and may not be used as identifiers (TODO: some keywords are allowed as identifiers). + +```go +break default func interface select +case defer go map struct +chan else goto package switch +const fallthrough if range type +continue for import return var +``` + +### Operators and punctuation + TODO ### Integer literals