Buenas tardes amigos una pregunta lo que pasa es que me dejaron hacer el analizador semantico en java, pero asi programamos las variables int #s12==0; por ejemplo como se le hace para separar ese valor de ==0 para separarlo de la cadena porque la caja de texto en donde esta el int #s12==0; es string , ya para despues hacer las operaciones y me aparezca el resultado como una suma normal
Si me pudieran ayudar
dejo el codigo
import java.util.ArrayList;
import javax.swing.JOptionPane;
public class Ventana extends javax.swing.JFrame {
String cadena;
int contLineas;
char a;
String c="";
String s="";
char finLinea,antLinea;
char vector[]= new char[20];
char ultimo;
int cont=0, contc=0;
int contparentesis=0, contcorchetes=0, contllaves=0, contfinal=0, contfinalc=0;
int contallaves=0, contcllaves=0, contaparent=0, contcparent=0, contacorch=0, contccorch=0;
int contadoresgato;
/** Creates for Brian */
public Ventana() {
initComponents();
variable1.setVisible(false);
variable2.setVisible(false);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
resultado = new javax.swing.JTextArea();
jScrollPane2 = new javax.swing.JScrollPane();
caja = new javax.swing.JTextArea();
variable1 = new javax.swing.JTextField();
variable2 = new javax.swing.JTextField();
semantico = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem4 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Analizador Sintáctico");
jPanel1.setBackground(new java.awt.Color(102, 102, 0));
resultado.setColumns(20);
resultado.setRows(5);
jScrollPane1.setViewportView(resultado);
caja.setColumns(20);
caja.setRows(5);
jScrollPane2.setViewportView(caja);
semantico.setText("reloj");
semantico.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
semanticoActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(65, 65, 65)
.addComponent(semantico, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(414, 414, 414)
.addComponent(variable2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(variable1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(128, 128, 128)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(53, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(semantico)