Go to file
Valk Richard Li 0196d196fe
Delete main.cpp
2020-06-07 13:03:47 +08:00
misc backup for multi assignment 2019-10-21 23:56:35 +08:00
pic add new logo 2020-03-09 15:53:28 +08:00
testing_files Add test file 2019-10-19 10:46:57 +08:00
version0.7 Add PDA demo for LR 2019-08-30 08:37:49 -05:00
version0.9 LL(1) demo & LR demo & nasal LR parser demo !!! 2019-08-30 11:43:46 -05:00
version0.19 Delete main.cpp 2020-06-07 13:03:47 +08:00
version1.0 Bug fixed 2019-10-14 22:53:30 +08:00
version1.1 Improvement 2019-10-22 00:04:36 +08:00
version1.2 Add some functions 2019-10-31 15:38:35 +08:00
version1.3 Update 2019-11-10 16:14:56 +08:00
version2.0 update 2020-05-29 10:25:48 -07:00
version3.0 update 2020-06-01 01:24:26 -07:00
.gitignore Initial commit 2019-07-25 02:11:59 +08:00
NASAL语言教程-完整版.pdf Add files via upload 2019-07-25 02:18:20 +08:00
README.md Update README.md 2020-06-01 14:57:37 +08:00

README.md

Nasal Interpreter

nasal_new_logo

Nasal script language

Nasal is a script language that used in FlightGear.

There is a Nasal console in FlightGear but sometimes it is not so easy for every developer to use.

So this is an interpreter for Nasal written by C++.

The interpreter is still in development.Anyone who interested in this could also join us!

Lexical Analysis

What do it's outputs look like?

( identifier | start )

( operator | ; )

( reserve word | print )

( operator | ( )

( string | Engine started )

( operator | ) )

This is what it outputs.

And the flow chart of lexer is here:

nasal_lexer.png

Push down automata

After many times of failure,i finally try to use PDA to do the parse work.

But something occurred,so i finally didn't make it.However you can still see this LL(1) and LR(0) parser in version 0.7 & 0.9 .

Parser

The parser can recognize some basic elements in resource program.

In version 1.1 you can use the fully-functional parser.

But there are still some differences such as:

(var a,b,c)=(1,2,3);
var (r,g,b)=color;
(a,b)=(b,a);

etc. cannot be recognized.

And each statement must have a ';' after it or you will be informed with 'error: expect a ';'' .

In version 2.0 these problems have been solved.

In version 2.0

(var a,b,c)=(1,2,3);
var (r,g,b)=color;

These two types of statements are both definition_expr.

(a,b,c)=(1,2,3);
(a,b)=(b,a);

This type of statement is multi_assignment.

And to check if an expr in '(' ')' is multi_scalar or multi_id

i used bool nasal_parse::check_multi_scalar() and bool nasal_parse::check_multi_assignment()

Abstract Syntax Tree

In version 1.2 the ast has been completed.

Version 2.0

a completed ast-interpreter with unfinished lib functions.

a new byte code interpreter is in progress(version 3.0).