Go to file
Valk Richard Li 610544dfde
Delete nasal_list.cpp
2019-08-08 22:48:28 +08:00
misc misc 2019-08-05 23:21:53 +08:00
version0.1 version 0.1 not finished 2019-08-08 02:24:49 +08:00
version0.2 update sort function 2019-08-08 21:17:50 +08: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 2019-08-08 21:22:22 +08:00
nasal.ebnf Rename nasal.ENBF to nasal.ebnf 2019-08-08 18:56:27 +08:00
nasal_list.h update print & var 2019-08-07 02:44:31 +08:00
nasal_print.h update print & var 2019-08-07 02:44:31 +08:00
nasal_var_stack.h update print & var 2019-08-07 02:44:31 +08:00

README.md

Nasal-Interpreter

Nasal

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!

Now complete all types

var: int float double std::string char long long int

NasalList: array in nasal []

append

setsize

subvec

pop

sort

NasalHash: Hash in nasal {}

append

delete

contains

keys

Now complete Lexical Analysis!

What it looks like?

( Identifier | engineTimer )

( Operator | . )

( Identifier | start )

( Operator | ( )

( Operator | ) )

( Operator | ; )

( ReserveWord | print )

( Operator | ( )

( String | "Engine started" )

( Operator | ) )

( Operator | ; )

( Operator | } )

( ReserveWord | var )

( Identifier | stopEngine )

( Operator | = )

( ReserveWord | func )

( Operator | ( )

( Operator | ) )

( Operator | { )

( Identifier | props )

( Operator | . )

( Identifier | getNode )

( Operator | ( )

( String | "/" )

( Operator | , )

( Number | 1 )

( Operator | ) )

( Operator | . )

( Identifier | setValue )

( Operator | ( )

( String | "/controls/engines/engine/started" )

( Operator | , )

( Number | 0 )

( Operator | ) )

( Operator | ; )

( Identifier | props )

( Operator | . )

( Identifier | getNode )

( Operator | ( )

( String | "/" )

( Operator | , )

( Number | 1 )

( Operator | ) )

( Operator | . )

( Identifier | setValue )

( Operator | ( )

( String | "/fdm/jsbsim/external_reactions/engine/magnitude" )

( Operator | , )

( Number | 0 )

( Operator | ) )

( Operator | ; )

( Identifier | props )

( Operator | . )

( Identifier | getNode )

( Operator | ( )

( String | "/" )

( Operator | , )

( Number | 1 )

( Operator | ) )

( Operator | . )

( Identifier | setValue )

( Operator | ( )

( String | "/systems/electrical/e-tron/switch/bat-fwd-eng" )

( Operator | , )

( Number | 0 )

( Operator | ) )

( Operator | ; )

( Identifier | props )

( Operator | . )

( Identifier | getNode )

( Operator | ( )

( String | "/" )

( Operator | , )

( Number | 1 )

( Operator | ) )

( Operator | . )

( Identifier | setValue )

( Operator | ( )

( String | "/systems/electrical/e-tron/switch/bat-bwd-eng" )

( Operator | , )

( Number | 0 )

( Operator | ) )

( Operator | ; )

( Identifier | engineTimer )

( Operator | . )

( Identifier | stop )

( Operator | ( )

( Operator | ) )

( Operator | ; )

( ReserveWord | print )

( Operator | ( )

( String | "Engine stopped" )

( Operator | ) )

( Operator | ; )

( Operator | } )

This is what it outputs.

Now with var_stack and function_stack

By printing the two stacks you can see how vars and functions change!

[long long int]a:1

[double]b:3.14

[string]c:"hello world!"

function:swap

function:__main

function:hello

The structure of basical elements is...

class var;

class nasal_hash;//forward declaration

struct nasal_list_unit;

class nasal_list;

struct nasal_hash_unit;

class nasal_hash;

struct token_unit;

struct parameter;

class func;

class token_list;

#include "nasal_lexer.h"

main();