diff --git a/README.md b/README.md index ce77f64..729fc27 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,38 @@ -# Nasal Script Language +# __Nasal Script Language__ -## Contents +```C++ + __ _ + /\ \ \__ _ ___ __ _| | + / \/ / _` / __|/ _` | | + / /\ / (_| \__ \ (_| | | + \_\ \/ \__,_|___/\__,_|_| +``` -* [Introduction](#introduction) -* [Why Writing Nasal Interpreter](#why-writing-nasal-interpreter) -* [Compile](#how-to-compile) -* [Usage](#how-to-use) -* [Parser](#parser) +## __Contents__ + +* [__Introduction__](#introduction) +* [__Why Writing Nasal Interpreter__](#why-writing-nasal-interpreter) +* [__Compile__](#how-to-compile) +* [__Usage__](#how-to-use) +* [__Parser__](#parser) * [v1.0](#version-10-parser-last-update-20191014) -* [Abstract Syntax Tree](#abstract-syntax-tree) +* [__Abstract Syntax Tree__](#abstract-syntax-tree) * [v1.2](#version-12-ast-last-update-20191031) * [v2.0](#version-20-ast-last-update-2020831) * [v3.0](#version-30-ast-last-update-20201023) * [v5.0](#version-50-ast-last-update-202137) -* [Bytecode VM](#bytecode-virtual-machine) +* [__Bytecode VM__](#bytecode-virtual-machine) * [v4.0](#version-40-vm-last-update-20201217) * [v5.0](#version-50-vm-last-update-202137) * [v6.0](#version-60-vm-last-update-202161) * [v6.5](#version-65-vm-last-update-2021624) * [v7.0](#version-70-vm-last-update-2021108) * [v8.0](#version-80-vm-latest) -* [Benchmark](#benchmark) +* [__Benchmark__](#benchmark) * [v6.5 (i5-8250U windows 10)](#version-65-i5-8250u-windows10-2021619) * [v6.5 (i5-8250U ubuntu-WSL)](#version-70-i5-8250u-ubuntu-wsl-on-windows10-2021629) * [v8.0 (R9-5900HX ubuntu-WSL)](#version-80-r9-5900hx-ubuntu-wsl-2022123) -* [Tutorial](#simple-tutorial) +* [__Tutorial__](#tutorial) * [basic value type](#basic-value-type) * [operators](#operators) * [definition](#definition) @@ -37,30 +45,43 @@ * [closure](#closure) * [trait](#trait) * [native functions](#native-functions) - * [modules](#modulesthis-is-for-library-developers) -* [Difference](#difference-between-andys-nasal-interpreter-and-this-interpreter) -* [Trace Back Info](#trace-back-info) -* [Debugger](#debugger) + * [modules](#modulesfor-library-developers) +* [__Difference__](#difference-between-andys-and-this-interpreter) + * [strict definition](#1-must-use-var-to-define-variables) + * [(outdated)use after definition](#2-now-supported-couldnt-use-variables-before-definitions) + * [default dynamic arguments](#3-default-dynamic-arguments-not-supported) +* [__Trace Back Info__](#trace-back-info) + * [native function 'die'](#1-native-function-die) + * [stack overflow](#2-stack-overflow-crash-info) + * [runtime error](#3-normal-vm-error-crash-info) + * [detailed crash info](#4-detailed-crash-info) +* [__Debugger__](#debugger) -## Introduction +__Contact us if having great ideas to share!__ -[Nasal](http://wiki.flightgear.org/Nasal_scripting_language) -is an ECMAscript-like programming language that used in [FlightGear](https://www.flightgear.org/). -This language is designed by [Andy Ross](https://github.com/andyross). +* __E-mail__: lhk101lhk101@qq.com -The interpreter is totally rewritten by [ValKmjolnir](https://github.com/ValKmjolnir) using C++(`-std=c++11`) -without reusing the code in [Andy Ross's nasal interpreter](). +* __QQ__: 896693328 + +## __Introduction__ + +__[Nasal](http://wiki.flightgear.org/Nasal_scripting_language)__ +is an ECMAscript-like programming language that used in __[FlightGear](https://www.flightgear.org/)__. +This language is designed by __[Andy Ross](https://github.com/andyross)__. + +The interpreter is totally rewritten by __[ValKmjolnir](https://github.com/ValKmjolnir)__ using `C++`(`-std=c++11`) +without reusing the code in __[Andy Ross's nasal interpreter]()__. But we really appreciate that Andy created this amazing programming language and his interpreter project. -Now this project uses MIT license (2021/5/4). +Now this project uses __MIT license__ (2021/5/4). Edit it if you want, use this project to learn or create more interesting things (But don't forget me XD). -## Why Writing Nasal Interpreter +## __Why Writing Nasal Interpreter__ In 2019 summer holiday, -members in [FGPRC](https://www.fgprc.org/) told me that it is hard to debug with nasal-console in Flightgear, +members in __[FGPRC](https://www.fgprc.org/)__ told me that it is hard to debug with nasal-console in Flightgear, especially when checking syntax errors. So i tried to write a new interpreter to help them checking syntax error and even, runtime error. @@ -76,25 +97,25 @@ interesting programs and run them without the lib of Flightgear. You could add your own modules to make this interpreter a useful tool in your own projects (such as a script in a game just as Flightgear does). -## How to Compile +## __How to Compile__ Better choose the latest update of the interpreter. Download the source code and build it! It's quite easy to build this interpreter. -MUST USE `-O2/-O3` if want to optimize the interpreter! +__MUST USE__ __`-O2/-O3`__ if want to optimize the interpreter! -Also remember to use g++ or clang++.(mingw-w64 in Windows) +Also remember to use g++ or clang++.(mingw-w64 in __`Windows`__) > [cpp compiler] -std=c++11 -O3 main.cpp -o nasal.exe -fno-exceptions -Or use this in linux/macOS/Unix +Or use this in __`linux/macOS/Unix`__ > [cpp compiler] -std=c++11 -O3 main.cpp -o nasal -fno-exceptions -ldl -## How to Use? +## __How to Use__ -Input this command to run scripts directly: +Input this command to run scripts __directly__: > ./nasal filename @@ -102,28 +123,66 @@ Use these commands to get version of interpreter: > ./nasal -v | --version +```bash + __ _ + /\ \ \__ _ ___ __ _| | + / \/ / _` / __|/ _` | | + / /\ / (_| \__ \ (_| | | + \_\ \/ \__,_|___/\__,_|_| +nasal interpreter ver 8.0 +thanks to : https://github.com/andyross/nasal +code repo : https://github.com/ValKmjolnir/Nasal-Interpreter +code repo : https://gitee.com/valkmjolnir/Nasal-Interpreter +lang info : http://wiki.flightgear.org/Nasal_scripting_language +input to get help . +``` + Use these commands to get help(see more debug commands in help): > ./nasal -h | --help -If your system is Windows and you want to output unicode,please use this command before running nasal interpreter: +```bash +nasal