Help for a REAL beginner

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Russell Mason
Avatar
Hi

I'm completely new to SyntaxEditor and find it all a bit overwhelming!

I'm having a go at SQL with intellisence etc. (I'm sure this has been done many times before but unless someone wants to give me their code I'll just have to do it myself!).

What is the best way to approach this? In your SQL example language you treat SELECT, UPDATE, EXECUTE, all as reserved words. This would mean in the semantic parser I would know that a reserved word has been parsed but would then have to check the token text to see if it was SELECT or UPDATE or EXECUTE or even EXEC etc. Then step forward looking for identifiers which may be column names or table names and may or may not have a WHERE clause which again is simply a reserved word. Is this the way to proceed? or would it be better to more clearly define the language? having SELECT as its own token, which switches into a column list state which switches to a FROM state which may or may not switch to a WHERE state etc, etc. This would mean I know when I get a SelectToken that I am doing a select statement and would then be in a state that more clearly defines column base tokens etc.

The first approach seems like a simpler language but more complex coding; the second approach seems like a complex language but simpler coding. I'm not sure where the line is between SyntaxEditor being a syntax highlighter (simply colouring words) and where it can help in the difficult bit of knowing where you are in the code (more complex state related information).

Whilst your documentation is extensive it lacks a simple introduction for the beginner who has never tackled lexical and semantic parsing before.

Any help or tips would be appreciated.

Thanks
Russell Mason

Comments (1)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Russell,

If you are doing complex stuff like that you might just find it easiest to take your second approach and make specific tokens for each keyword. SyntaxEditor's lexical parser is pretty powerful and can easily handle that for you. Then you can minimize the amount of semantic parsing needed to distinguish keywords.


Actipro Software Support

The latest build of this product (v24.1.0) was released 25 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.