please dont rip this site

Keyword Interpreter Code Generator

By Nikolai Golovchenko

Keywords List


Whitespaces:
Delimeters:
Case insensitive
Whole words match


Description

This code generator produces the PIC assembler code to look for keywords in a string or a serial ASCII stream.

Parsing routine receives one character at a time and returns the keyword code, or the next state, or error code. The keywords codes are given in the order they were written, starting from 1.

You can specify whether keywords are matched as the whole words or just starting unique part. This let's you use shorthand names for the keywords. Also, case insensitiveness can be specified.

The routine can skip whitespaces before a keyword. Enter the desired characters in the form entry Whitespaces. In some cases it's probably better to delete carriage return (0x0d) or line feed (0x0a) characters if you don't need them, or add some others. To detect the end of a keyword the routine needs to know what characters separate keywords in the text stream (form entry Delimiters). Often, they are the same as whitespaces, but you might want to add '\0' to work with zero terminated strings, or '(' in case the keyword is a function name, e.g. Speed(100). A delimiter character is received as a look-ahead character after a keyword matched to make sure that the keyword ended.



The routine is implemented as a variation of state machine, without explicit tables. The routine is a relatively fast runner, since it compares a character to a minimum number of constant characters, just enough to disambiguate the text meaning.

The size of the generated code is directly related to the number of keywords and their length. It takes about four instructions of program memory per each character in the text area plus jump table and a couple of small routines.

See example on how to call the parsing routine.


See:

Questions:

See also:


file: /Techref/piclist/codegen/keyword_interpreter.htm, 4KB, , updated: 2022/12/23 14:29, local time: 2024/12/25 05:38,
TOP NEW HELP FIND: 
18.221.147.141:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.sxlist.com/techref/piclist/codegen/keyword_interpreter.htm"> Keyword Interpreter Code Generator</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed? From: "http://sxlist.com/piclist/codegen/keyword_interpreter"

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to www.sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .