Re: Script Parser
- From: "L7" <jesse.r.brown@xxxxxxxxx>
- Date: 31 Aug 2006 04:47:26 -0700
CJReilly@xxxxxxxxx wrote:
I am trying to build a simple script parser with basic-like syntax and
including the standard loops, variables, if/else statements, and such
found in most core languages.
I was hoping someone could point me to a good resource. I've tried
searching for books and articles online, but no luck. :-( Unfortunately
my comp. sci. class voted against the script parser lesson.
- Chris
Any language that is to make it (that is, do what it is designed to
do), is going to have to have a grammar associated with it. Once the
grammar is built, there needs to be a tool that, based on that grammar,
will parse the input (either all at one or one token at a time) and
generate code or errors accordingly.
Fortunately, there are tools that work together. Lex (or Flex) and Yacc
are two such tools. Originaly, you had to have a strong grasp on the C
language, but these tools have been ported to other languages as well.
google : Lex and Yacc
For further details.
Once you have that down - the grammar and parsing - you will probably
want to look into things such as call stacks and symbol tables.
OT:
Kudos to you for wanting to learn more than you are being taught. THe
fact you may never use this language once you are done doesn't change
the benefit you'll get from the experience. Having to design your own
language provides insignt into the design of other languages that most
site as 'annoyances'.
.
- References:
- Script Parser
- From: CJReilly
- Script Parser
- Prev by Date: Re: How to compute triangle base/altitude intersection
- Next by Date: Re: cgi-script problem
- Previous by thread: Re: Script Parser
- Next by thread: Re: Script Parser
- Index(es):
Relevant Pages
|