JSGEN is an extension to AllegroServe that allows one to write JavaScript programs in an s-expression syntax. The primary advantage of this approach is that the user has the ability to extend the language using macros, resulting in shorter more manageable programs. A disadvantage is that the debugging of programming errors within a web browser will require working with the generated JavaScript code. Errors raised in the browser will have to be manually traced to their source within corresponding s-expression code. JSGEN is a good choice if you believe the benefits of syntactic abstraction (shorter programs, fewer bugs) outweighs the cost added to the debugging process.

Programs written in s-expression JavaScript are called sjs programs and should be saved in files with the extension sjs. AllegroServe has been extended so that when a file of type sjs is requested, the file is translated, and the corresponding JavaScript is returned.

JSGEN maps all operators and keywords defined in ECMA 262 to s-expressions. One approach to translation is to develop rules for transforming verbose s-expressions to more concise JavaScript. For example the translator could remove parentheses based on operator precedence or perform transformations such as (= i (+ i 1)) -> i += 1. Another approach would be to make sjs into a separate language that has more in common with lisp than JavaScript. However, since there will be a need to match JavaScript code to s-expression code in the debugging process, the approach taken by JSGEN is to avoid these types of transformations and strive for a direct mapping from the s-expression code to JavaScript. Users can selectively deviate from the mapping through the use of user-defined extension macros. In fact, users can use the extension macros to create a whole new language. JSGEN predefines a set of macro extensions for situations where the mapping from JavaScript to s-expressions is rather clumsy.