All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.plantuml.jasic.Jasic Maven / Gradle / Ivy

Go to download

PlantUML is a component that allows to quickly write : * sequence diagram, * use case diagram, * class diagram, * activity diagram, * component diagram, * state diagram * object diagram

There is a newer version: 8059
Show newest version
package net.sourceforge.plantuml.jasic;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*
 Jasic uses the MIT License:

 Copyright (c) 2010 Robert Nystrom

 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal in
 the Software without restriction, including without limitation the rights to
 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 the Software, and to permit persons to whom the Software is furnished to do so,
 subject to the following conditions:

 The above copyright notice and this permission notice shall be included in all
 copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */
/*
 * This defines a single class that contains an entire interpreter for a language very similar to the original BASIC.
 * Everything is here (albeit in very simplified form): tokenizing, parsing, and interpretation. The file is organized
 * in phases, with each appearing roughly in the order that they occur when a program is run. You should be able to read
 * this top-down to walk through the entire process of loading and running a program.
 * 
 * Jasic language syntax ---------------------
 * 
 * Comments start with ' and proceed to the end of the line:
 * 
 * print "hi there" ' this is a comment
 * 
 * Numbers and strings are supported. Strings should be in "double quotes", and only positive integers can be parsed
 * (though numbers are double internally).
 * 
 * Variables are identified by name which must start with a letter and can contain letters or numbers. Case is
 * significant for names and keywords.
 * 
 * Each statement is on its own line. Optionally, a line may have a label before the statement. A label is a name that
 * ends with a colon:
 * 
 * foo:
 * 
 * 
 * The following statements are supported:
 * 
 *  =  Evaluates the expression and assigns the result to the given named variable. All variables are
 * globally scoped.
 * 
 * pi = (314159 / 10000)
 * 
 * print  Evaluates the expression and prints the result.
 * 
 * print "hello, " + "world"
 * 
 * input  Reads in a line of input from the user and stores it in the variable with the given name.
 * 
 * input guess
 * 
 * goto 




© 2015 - 2024 Weber Informatics LLC | Privacy Policy