Files
CHOMPStation2/code/modules/scripting/AST/Statements.dm
vageyenaman@gmail.com bbe42a34d8 More work done on Telecomms:
▫ Signals can now be rejected by Subspace broadcasters through a specific data[] parameter.
▫ Improved the log browser.
▫ Log browsers and telecommunication monitors no longer require access to use. You do need access to delete logs, however.
▫ Intercoms need power to work. They don't drain power, they just need a constant flow of equipment power. As such, that offline intercom sprite's now finally being put to use.

Scripting language:

▫ Sorry about all the files; they're all necessary! It's important to notice that the basic structure of the scripting language code is not mine; I cannibalized the base structure from some obscure BYOND project. It's pretty well documented, and I'd say easier to browse through than atmos. Here's the basic deal:

A compiler datum manages the relationships between the three main subsystems of a scripting language: the Scanner, the Parser, and the Interpreter. The Scanner splits raw text into token datums that the Parser can read. The Parser transforms the otherwise random bits and strings into ordered AST Trees and nodes for the Interpreter to read. The interpreter actually executes the code and handles scope/functions/code blocks.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3193 316c924e-a436-60f5-8080-3fe189b3f50e
2012-02-28 17:36:18 -07:00

122 lines
2.0 KiB
Plaintext

/*
File: Statement Types
*/
/*
Class: statement
An object representing a single instruction run by an interpreter.
*/
/node/statement
/*
Class: FunctionCall
Represents a call to a function.
*/
//
FunctionCall
var
func_name
node/identifier/object
list/parameters=new
/*
Class: FunctionDefinition
Defines a function.
*/
//
FunctionDefinition
var
func_name
list/parameters=new
node/BlockDefinition/FunctionBlock/block
/*
Class: VariableAssignment
Sets a variable in an accessible scope to the given value if one exists, otherwise initializes a new local variable to the given value.
Notes:
If a variable with the same name exists in a higher block, the value will be assigned to it. If not,
a new variable is created in the current block. To force creation of a new variable, use <VariableDeclaration>.
See Also:
- <VariableDeclaration>
*/
//
VariableAssignment
var
node
identifier
object
var_name
expression/value
/*
Class: VariableDeclaration
Intializes a local variable to a null value.
See Also:
- <VariableAssignment>
*/
//
VariableDeclaration
var
node
identifier
object
var_name
/*
Class: IfStatement
*/
//
IfStatement
var
node
BlockDefinition
block
else_block //may be null
expression/cond
/*
Class: WhileLoop
Loops while a given condition is true.
*/
//
WhileLoop
var
node
BlockDefinition/block
expression/cond
/*
Class: ForLoop
Loops while test is true, initializing a variable, increasing the variable
*/
ForLoop
var
node
BlockDefinition/block
expression/test
expression/init
expression/increment
/*
Class: BreakStatement
Ends a loop.
*/
//
BreakStatement
/*
Class: ContinueStatement
Skips to the next iteration of a loop.
*/
//
ContinueStatement
/*
Class: ReturnStatement
Ends the function and returns a value.
*/
//
ReturnStatement
var
node/expression/value