dasic library

Copyright (c) 2015, Michael Mitterer (office@mikemitterer.at), IT-Consulting and Development Limited.

All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Classes

AssignStatement
An assignment statement evaluates an expression and stores the result in a variable.
Expression
Base interface for an expression. An expression is like a statement except that it also returns a value when executed. Expressions do not appear at the top level in Dasic programs, but are used in many statements. For example, the value printed by a "print" statement is an expression. Unlike statements, expressions can nest.
GotoStatement
A "goto" statement jumps execution to another place in the program.
IfThenStatement
An if then statement jumps execution to another place in the program, but only if an expression evaluates to something other than 0.
InputStatement
An "input" statement reads input from the user and stores it in a variable.
Interpreter
Lexer
NumberValue
A numeric value. Dasic uses doubles internally for all numbers.
OperatorExpression
An operator expression evaluates two expressions and then performs some arithmetic operation on the results.
Parser
This defines the Dasic parser. The parser takes in a sequence of tokens and generates an abstract syntax tree. This is the nested data structure that represents the series of statements, and the expressions (which can nest arbitrarily deeply) that they evaluate. In technical terms, what we have is a recursive descent parser, the simplest kind to hand-write. [...]
PrintStatement
A "print" statement evaluates an expression, converts the result to a string, and displays it to the user.
Statement
Base interface for a Dasic statement. The different supported statement types like "print" and "goto" implement this.
StringValue
A string value.
Token
This is a single meaningful chunk of code. It is created by the tokenizer and consumed by the parser.
Utils
Value
This is the base interface for a value. Values are the data that the interpreter processes. They are what gets stored in variables, printed, and operated on. [...]
VariableExpression
A variable expression evaluates to the current value stored in that variable.

Enums

TokenizeState
This defines the different states the tokenizer can be in while it's scanning through the source code. Tokenizers are state machines, which means the only data they need to store is where they are in the source code and this one "state" or mode value. [...]
TokenType
This defines the different kinds of tokens or meaningful chunks of code that the parser knows how to consume. These let us distinguish, for example, between a string "foo" and a variable named "foo". [...]