input file:in.txt output file:out.txt
time limit: 500ms
language:ASM、C、C++、C#、Java、VB
time limit: 500ms
language:ASM、C、C++、C#、Java、VB
Difficulty:★★★★
Describe:
The backtracking algorithm is the most fundamental part but not the most graceful part of this project's underlying as we will also use compiling technique on it.Let's have a look at the simple set and subset problem.Assume that we have a universal set U and n subsets I0,I1...In.Now several logical expressions have given to you,please try to make lexical analysis on them.
Input:
The first line:Define variables in the format shown in Sample Input;
The following lines:Logic expressions in the format shown in Sample Input.
Output:
For each expression,print out all its words.If there is some syntax errors in the input file,print a single line showing the first syntax error and its line number in the format shown in Sample Output.
Notice that you don't have to find out all the syntax errors in input file.
Sample Input1:
dim 变量一,变量二,条件A,条件B,flag,flag_
printwords 变量一&(变量二|flag)
printwords !(条件A|flag&条件B)&flag_|!变量一
Sample Output1:
变量一
&
(
变量二
|
flag
)
!
(
条件A
|
flag
&
条件B
)
&
flag_
|
!
变量一
Sample Input2:
define 变量一,变量二,条件A,条件B,flag,flag_
printwords 变量一&(变量二|flag)
printwords !(条件A|flag&条件B)&flag_|!变量一
Sample Output2:
Error(Line 1):Undecleared identitier "define"!
Sample Input3:
dim 变量一,变量二,条件A,条件B,flag
printwords 变量一&(变量二|flag)
printwords !(条件A|flag&条件B)&flag_|!变量一
Sample Output3:
Error(Line 3):Undecleared identitier "flag_"!
Sample Input4:
dim 变量一,变量二,条件A,条件B,flag
printwords 变量一&&(变量二|flag)
printwords !(条件A|flag&条件B)&flag_|!变量一
Sample Output4:
Error(Line 2):
Unrecognized expression: "&&"!