answersLogoWhite

0


Best Answer

%{

#include<stdio.h>

int valid=1;

%}

%token digit letter

%%

start : letter s

s : letter s

| digit s

|

;

%%

int yyerror()

{

printf("\nIts not a identifier!\n");

valid=0;

return 0;

}

int main()

{

printf("\nEnter a name to tested for identifier ");

yyparse();

if(valid)

{

printf("\nIt is a identifier!\n");

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Yacc program to recognize a valid variable which starts with letters followed by any number of level of digits?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

C plus plus program to add a letter in a permanent letters alphabetically?

If by permanent you mean constant, you cannot change something that is constant, therefore you cannot add to it (letters or otherwise). It has to be variable. Constant and variable are mutually exclusive terms.


Program will be followed by dinner or shall be followed by dinner?

The program shall be followed by dinner.


If the variable flag can only be declared once in the program it was declared as what type of variable?

It's a global variable.


What is a variable used in computer gaming?

it depends, if its a desired variable, its a program, but if its undesired, its a glitch


How do you program a hayward variable speed pool pump?

how to program a pool vacuum


What is the scope of a data statement?

The scope of a data statement refers to where in the program the data is accessible. It defines the visibility and accessibility of the data within a program, determining which parts of the program can access and manipulate the data. Properly scoping data helps in managing data effectively and preventing unintended side effects.


A variable that is used in all program modules is?

global


When auto variable create?

Program enter function.


What is the variable in c language program?

A variable is the name for a place in the computer's memory where you store some data.


Which specifier indicates that a variable's reserved space in the memory can be erased or relocated when the variable is out of its scope?

There is no such thing. When the program leaves the scope of the variable, it will be release the memory of the variable automatically and unconditonally.


A class in a program whose objects are created and destroyed throughout the program It is desired that the total number of live objects in the program be known how you do this in C plus plus?

Create a static member variable to contain the count. This variable is common to all instances of the class.Initialize that variable to zero at the beginning of the program.In the class constructor, increment the variable.In the class destructor, decrement the variable.


Write the difference between global variable and static variable in context to function with suitable example?

Static VariableA variable that exists in only one location and is globally accessible by all instances of a class and also a variable for which memory remains allocated as long as the program executes.Global VariableA variable that can be accessed by all parts of a program so it does not belong to any subroutine in particular and can therefore can be accessed from any context in a program