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 15:29, local time: 2024/10/31 15:57,
TOP NEW HELP FIND: 
3.147.74.27:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©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.piclist.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: "/Techref/microchip/piclist/codegen/keyword_interpreter.htm"

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 
Quick, Easy and CHEAP! RCL-1 RS232 Level Converter in a DB9 backshell
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .