1.8 KiB
Nasal Interpreter
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:
Parser
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().
In version 3.0
I refactored parser and make it easier to maintain.
the EBNF is also refactored.
Abstract Syntax Tree
In version 1.2 the ast has been completed.
In version 3.0 the ast is refactored and is now easier to read and maintain.
Version 2.0
a completed ast-interpreter with unfinished lib functions.
Version 3.0
ast-interpreter uses new techniques so it can run codes more efficiently.
byte-code-interpreter is in progress(i need a lot of time to learn that :( ).

