├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── VERSION ├── doc.go ├── docs ├── 404.html ├── CNAME ├── _config.yml ├── _includes │ ├── disqus.html │ ├── download.html │ ├── download.js │ ├── ga.js.temp │ ├── shared-deps.html │ ├── shared-footer.html │ ├── shared-header.html │ ├── toc-section.html │ ├── toc-section.js │ └── toc.html ├── _layouts │ ├── blog-home.html │ ├── default.html │ ├── dl.html │ └── post.html ├── api-cn.md ├── api.md ├── assets │ ├── css │ │ └── style.scss │ └── js │ │ └── platform.js ├── blog.md ├── downloads.md ├── index-cn.md └── index.md ├── extensions ├── README.md └── midc │ ├── codec │ ├── ext.json │ └── templates │ │ └── go │ │ ├── after_import.go.temp │ │ ├── after_protocol.go.temp │ │ ├── after_struct.go.temp │ │ ├── before_import.go.temp │ │ ├── decode.go.temp │ │ ├── decode │ │ ├── decode_array.go.temp │ │ ├── decode_bool.go.temp │ │ ├── decode_byte.go.temp │ │ ├── decode_int.go.temp │ │ ├── decode_int16.go.temp │ │ ├── decode_int32.go.temp │ │ ├── decode_int64.go.temp │ │ ├── decode_int8.go.temp │ │ ├── decode_map.go.temp │ │ ├── decode_string.go.temp │ │ ├── decode_struct.go.temp │ │ ├── decode_type.go.temp │ │ ├── decode_uint.go.temp │ │ ├── decode_uint16.go.temp │ │ ├── decode_uint32.go.temp │ │ ├── decode_uint64.go.temp │ │ ├── decode_uint8.go.temp │ │ └── decode_vector.go.temp │ │ ├── encode.go.temp │ │ ├── encode │ │ ├── encode_array.go.temp │ │ ├── encode_bool.go.temp │ │ ├── encode_byte.go.temp │ │ ├── encode_int.go.temp │ │ ├── encode_int16.go.temp │ │ ├── encode_int32.go.temp │ │ ├── encode_int64.go.temp │ │ ├── encode_int8.go.temp │ │ ├── encode_map.go.temp │ │ ├── encode_string.go.temp │ │ ├── encode_struct.go.temp │ │ ├── encode_type.go.temp │ │ ├── encode_uint.go.temp │ │ ├── encode_uint16.go.temp │ │ ├── encode_uint32.go.temp │ │ ├── encode_uint64.go.temp │ │ ├── encode_uint8.go.temp │ │ └── encode_vector.go.temp │ │ └── for_var.go.temp │ └── meta │ ├── ext.json │ └── templates │ ├── cpp │ ├── after_protocol.cpp.temp │ ├── after_struct.cpp.temp │ ├── protocol_front.h.temp │ └── struct_front.h.temp │ └── go │ ├── after_protocol.go.temp │ └── after_struct.go.temp ├── go.mod ├── go.sum ├── hack └── genmeta.sh ├── install.sh ├── languages.txt ├── midconfig ├── release.sh ├── src ├── cmd │ ├── mid-gen-cpp │ │ ├── main.go │ │ └── types.go │ ├── mid-gen-csharp │ │ ├── main.go │ │ └── types.go │ ├── mid-gen-go │ │ ├── main.go │ │ └── types.go │ ├── mid-gen-js │ │ ├── main.go │ │ └── types.go │ ├── mid-gen-protobuf │ │ ├── main.go │ │ └── types.go │ ├── mid-gen-ts │ │ ├── main.go │ │ └── types.go │ └── midc │ │ ├── config.go │ │ └── main.go ├── genutil │ ├── context.go │ ├── format.go │ ├── generator.go │ ├── template.go │ ├── types.go │ └── values.go └── mid │ ├── ast │ ├── ast.go │ └── scope.go │ ├── build │ ├── builder.go │ ├── extension.go │ ├── id_allocator.go │ ├── plugin.go │ ├── types.go │ └── types_test.go │ ├── external │ └── go │ │ └── scanner │ │ └── scanner.go │ ├── lexer │ ├── position.go │ └── token.go │ ├── meta.go │ ├── parser │ ├── helper.go │ ├── parser.go │ └── parser_test.go │ ├── scanner │ ├── scanner.go │ └── scanner_test.go │ └── syntax │ └── syntax.mid ├── templates ├── _common │ └── go │ │ ├── const.go.temp │ │ ├── enum.go.temp │ │ ├── fn_table_key.temp │ │ ├── fn_xorm.temp │ │ ├── head.go.temp │ │ ├── import.go.temp │ │ ├── package.sql.temp │ │ ├── protocol.go.temp │ │ ├── service.go.temp │ │ ├── storage_init.go.temp │ │ └── struct.go.temp ├── beans │ ├── cpp │ │ ├── const.h.temp │ │ ├── enum.h.temp │ │ ├── protocol.cpp.temp │ │ ├── protocol.h.temp │ │ ├── service.cpp.temp │ │ ├── service.h.temp │ │ ├── struct.cpp.temp │ │ └── struct.h.temp │ └── go │ │ ├── const.go.temp │ │ ├── enum.go.temp │ │ ├── protocol.go.temp │ │ ├── service.go.temp │ │ └── struct.go.temp ├── default │ ├── cpp │ │ ├── package.cpp.temp │ │ └── package.h.temp │ ├── go │ │ └── package.go.temp │ └── js │ │ └── package.js.temp ├── storage │ └── go │ │ ├── const.go.temp │ │ ├── enum.go.temp │ │ ├── package.go.init.temp │ │ ├── package.sql.temp │ │ ├── protocol.go.temp │ │ ├── service.go.temp │ │ └── struct.go.temp └── storage_onefile │ └── go │ ├── package.go.temp │ └── package.sql.temp ├── testdata ├── demo.mid ├── demo.sh └── main.go └── x ├── cpp ├── include │ └── mid │ │ ├── core │ │ └── std.h │ │ └── proto │ │ ├── decoder.h │ │ ├── encoder.h │ │ └── proto.h ├── proto │ ├── decoder.cpp │ ├── encoder.cpp │ └── proto.cpp └── tests │ ├── cbuild.json │ └── main.cpp └── go └── codec ├── codec.go ├── decoder.go ├── encoder.go ├── zcode_bench_test.go └── zcode_test.go /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | *.DS_Store 4 | src/cmd/midc/midc 5 | src/cmd/mid-gen-go/mid-gen-go 6 | src/cmd/mid-gen-cpp/mid-gen-cpp 7 | src/cmd/mid-gen-js/mid-gen-js 8 | src/cmd/mid-gen-protobuf/mid-gen-protobuf 9 | testdata/generated/ 10 | targets/ 11 | x/go/storage/example/demo/ 12 | 13 | docs/_site/ 14 | docs/.sass-cache/ 15 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Change log 2 | ========== 3 | 4 | ## Head 5 | 6 | ## v0.1.3 (2018-08-25) 7 | 8 | * Fix docs 9 | * Fix APIs 10 | * Add `js` generator 11 | 12 | ## v0.1.2 (2016-12-12) 13 | 14 | * Add extension `meta` and `proto` 15 | * Add template `beans/cpp` 16 | * Add `deps` in Extension 17 | * Add embedded positions `*_front` and `*_back` 18 | * Fix template `default/cpp` 19 | * Add docs directory 20 | 21 | ## v0.1.1 (2016-12-03) 22 | 23 | * Fix templates `default` for go 24 | * Add supporting `extension` 25 | * Fix compiler `midc` 26 | * Add generator `gencpp` 27 | 28 | ## v0.1 (2016-11-22) 29 | 30 | * Add `Context` for templates which used for generator 31 | * Add builtin templates `default` and `beans` 32 | * Add compiler `midc` and generator `gengo` 33 | * Add midlang builder 34 | * Add midlang lexer,ast,parser 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 midlang 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so, subject to the following 8 | conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 14 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 15 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 16 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 17 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 18 | OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | midlang 2 | ======= 3 | ``` 4 | ___ ___ ___ ___ ___ ___ ___ 5 | /\__\ /\ \ /\ \ /\__\ /\ \ /\__\ /\ \ 6 | /::L_L_ _\:\ \ /::\ \ /:/ / /::\ \ /:| _|_ /::\ \ 7 | /:/L:\__\ /\/::\__\ /:/\:\__\ /:/__/ /::\:\__\ /::|/\__\ /:/\:\__\ 8 | \/_/:/ / \::/\/__/ \:\/:/ / \:\ \ \/\::/ / \/|::/ / \:\:\/__/ 9 | /:/ / \:\__\ \::/ / \:\__\ /:/ / |:/ / \::/ / 10 | \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ 11 | ``` 12 | 13 | * [x] [English](https://midlang.org) 14 | * [x] [中文](https://midlang.org/cn) 15 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.1.11 2 | -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | package mid 2 | 3 | // The aim of the first stage is to implement a Domain-specific language,but have some differences. 4 | // 5 | // The code generated by midlang is highly customizable. Use templates to generate code, even documents. 6 | // midlang was committed to eradicating boring and tedious code which can be generated, not just as a data interchange format. 7 | // The compiler midc compile midlang source code to an AST, and then you can visit the AST in template file. 8 | // 9 | // https://midlang.org/#whats-midlang 10 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | notoc: true 4 | --- 5 | 6 | 27 | 28 |
4 | {% if site.email %}E-mail: {{ site.email }}{% endif %} 5 | {% if site.facebook_username %}Facebook: {{ site.facebook_username }}{% endif %} 6 | {% if site.twitter_username %}Twitter: {{ site.twitter_username }}{% endif %} 7 | {% if site.github_username %}Github: {{ site.github_username }}{% endif %} 8 | {% if site.wechat_id %}WeChat: {{ site.wechat_id }}{% endif %}9 |
26 | {{ page.date | date: "%Y/%m/%d %H:%M" }} 27 | {% if page.previous.url %} 28 | Prev 29 | {% endif %} 30 | {% if page.next.url %} 31 | Next 32 | {% endif %} 33 |
34 | 35 | {% include toc-section.html %} 36 | 37 |