This is a toy interpreter for the panda
programming language. It has a AST Tree walker based evaluater as well as a Compiler + VM structure. It is superficially based on the monkey
programming language.
var hello = "Hello,";
var world = "World!";
print(hello, world); // Output: Hello, World!
- Mutable and Immutable variables. Immutable variables use
const
keyword. - Added Assignment Expressions.
IDENTIFIER
's,INDEX_EXPRESSION
's andMETHOD_EXPRESSIONS
's can be assigned to - Added
CHAR
data type based on rust'schar
- Added
while
andfor
loops. - Added a few new builtin functions.
- Added the
nil
keyword and its equality comparison with others - Added function statement in
fn <IDENT>(<ARGUMENTS>) <BODY>
format. - Added
FLOAT
data-type based on rust'sf64
- Added bitwise operators
>>
,<<
,&
,|
,^
and boolean operators&&
and||
(These two are valid for all data types and are short-circuit evaluated). STR
's are aVec<char>
instead of standardString
/&str
as it makes manipulation easier.- Changed
is_truthy()
evaluation criteria and makin it similar topython
's implementation with empty strings, arrays and hashes as well zero (both forINT
andFLOAT
) beingfalsey
. - Restricted allowed types inside arrays.
- Added rust style range expression using
..
with reverse, negative and step support in the format<EXPR>..<EXPR>[..<EXPR>]
. - Added
STR
andARRAY
slicing usingRANGE
. - Added a simple type system.
- Added
import
statements and scope expressions using::
for accessing module members. - Added
STR
andCHAR
character escaping. - Added nil variable declaration i.e. declaring variable without any value.
- Added
delete
statement to remove variables
- List all the
features
in the above section. - Finalize a formal grammar for future reference.
- Create a standard library for use in import systems.
- Add a type system with more features like runtime type checking (i.e. wrapping rust
Objects
inside panda'sstd
types). - Write tests for every
AST
andObject
.