Java Tools Section Index | Page 92
Are there any JSP engines which support JavaScript?
Yes. Resin 1.0 from Caucho Technologies supports both Java and JavaScript
for scripting and implements JSP 1.0.
PolyJSP from Plenix supports Java, JavaScript and
WebL for scripting, and implement...more
How can I handle languages where keywords can also be identifiers?
> From: kearneym@piercom.ie
>
>
> How can I handle the strings which can be token and identifier at the
> same time.
> I have been writting the parser for the SQL,
> and just found out that ...more
All I know is that I need to build a parser or translator. Give me an overview of what ANTLR does and how I need to approach building things with ANTLR.
[See also Getting started ]
To build a language recognizer, you specify the structure of that langage with a grammar and then have ANTLR generate a Java or C++ class definitio...more
Can I do (one-pass) code generation with a tree parser? What is the normal code generation strategy?
If your language is complicated and difficult to compile (e.g., C++,
Verilog, VHDL) then the [one-pass "syntax-directed" translation]
technique is not powerful enough. It also does not work well...more
Does ANTLR always backtrack if I use a syntactic predicates?
No. ANTLR only backtracks if it cannot decide between the predicated alternative and the others in that alternative block. So if you have:
stat : (decl)=>decl
| expr
| ifstat
;
...more
How can I avoid traversing a subtree while tree parsing? Is there an operator or command for this?
Use the wildcard "placeholder", which lets you label the subtree, but the tree parser does not descend into the subtree to parse it.
How can I deal with statements split across lines with a continuation character like Fortran or COBOL or the C preprocessor?
In COBOL, source statements are still restricted to 80 columns with
source sequence numbers in columns 1-6, then the indicator column in
column 7, etc. If you had a long statement, you would code...more
How can I handle '-' (minus sign) in my identifiers or keywords?
Think about how you would do it by
hand. You would have to know when there is a hyphen and then make sure
that if there is a hyphen you don't return an IDENTIFIER. Make a lexical rule that match...more
How do I propagate/copy a type tree to multiple declarators of a variable declaration?
The Java grammar does this. For example, you want to propogate the INT tree node down to the rule that matches declarators like a and b in the following:
int a,b;
more
How do I recognize identifiers that can start with a number?
How about factoring...easiest way:
ID_OR_NUM : DIGITS (ID {$setType(ID);} | {$setType(NUMBER);}) ;
where ID and NUMBER are protected...
How to I create a list nodes instead of a two-dimensional tree?
Use null as first arg to list constructor.
What do "syntax" and "semantics" mean and how are they different?
A language is a set of valid sentences. What makes a sentence
valid? You can break validity down into two things: syntax and
semantics. The term syntax refers to grammatical structure
whereas t...more
What is the difference between a heterogeneous tree and a homogeneous tree; why would I want one over the other?
can use grammar to walk
handcoded use of heter trees
simpler
trick: allow both
Why do I get the following Java interpreter error: "Can't find antlr/Tool"?
Your CLASSPATH is set wrong. Make sure that antlr.jar or the main ANTLR directory is in your path.
watch out for cafe also; sets path wrong
Why doesn't my definition of string or comment does not match all characters in my input or why aren't my tokens defined by string literals matched by the lexer?
Set the char vocabulary to include all characters in your input
stream. Usually, you want charVocab='3'..'377'; in the lexer
options section.
Make sure that you have not turned off literals tes...more