beaver.Action Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of soot Show documentation
Show all versions of soot Show documentation
A Java Optimization Framework
The newest version!
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This file is part of Beaver Parser Generator. *
* Copyright (C) 2003,2004 Alexander Demenchuk . *
* All rights reserved. *
* See the file "LICENSE" for the terms and conditions for copying, *
* distribution and modification of Beaver. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package beaver;
/**
* An "interface" to Java code executed when a production is reduced.
*/
public abstract class Action
{
static public final Action NONE = new Action()
{
public Symbol reduce(Symbol[] args, int offset)
{
return new Symbol(null);
}
};
static public final Action RETURN = new Action()
{
public Symbol reduce(Symbol[] args, int offset)
{
return args[offset + 1];
}
};
/**
* Am action code that is executed when the production is reduced.
*
* @param args an array part of which is filled with this action arguments
* @param offset to the last element BEFORE the first argument of this action
* @return a symbol or a value of a LHS nonterminal
*/
public abstract Symbol reduce(Symbol[] args, int offset);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy