Nasal-Interpreter/README.md

63 lines
1.2 KiB
Markdown
Raw Normal View History

2019-09-02 12:11:31 +08:00
# Nasal Interpreter
2019-08-28 23:03:31 +08:00
2019-07-25 02:14:33 +08:00
# 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++.
2019-07-25 02:17:35 +08:00
The interpreter is still in development.Anyone who interested in this could also join us!
2019-07-28 00:06:29 +08:00
2019-08-25 00:41:12 +08:00
2019-09-09 22:55:05 +08:00
# Now complete add and sub in abstract syntax tree
2019-07-28 00:06:29 +08:00
2019-09-09 22:55:05 +08:00
And add a command 'ast' to see the AST
2019-07-28 00:06:29 +08:00
2019-09-09 22:55:05 +08:00
and command 'run' can give you the result
2019-07-28 00:06:29 +08:00
2019-07-29 21:50:18 +08:00
# Now complete Lexical Analysis!
2019-07-28 00:06:29 +08:00
2019-09-25 20:49:06 +08:00
What do it's outputs look like?
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Identifier | engineTimer )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Operator | . )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Identifier | start )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Operator | ( )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Operator | ) )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Operator | ; )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( ReserveWord | print )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Operator | ( )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( String | "Engine started" )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Operator | ) )
2019-07-29 21:50:18 +08:00
2019-07-30 21:01:04 +08:00
( Operator | ; )
2019-07-29 21:50:18 +08:00
This is what it outputs.
2019-08-07 02:48:03 +08:00
2019-08-28 15:37:21 +08:00
# Push down automata
After many times of failure,i finally try to use PDA to do the parse work.
2019-09-25 20:49:06 +08:00
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
# Now complete Parser
The parser can recognize some basic elements in resource program.
And in future i will make it to support more flexible grammar.
2019-10-01 23:16:04 +08:00
# Calculator
You can try a calculator in version 0.17~0.19 !