Ex-HTML

CSEF · 2014 Mathematics & Software

Overview

Objectives/Goals Create an alternative syntax for HTML called Lima, modeled around the LISP family of programming languages. HTML is quite verbose for many tasks, and that#s what I wanted to improve, while allowing Lima to be compiled down to HTML. Similar projects have been created for CSS (Sass, LESS) and JavaScript (CoffeeScript), but HTML didn#t yet have anything similar. I chose LISP because its syntax is versatile and simple, allowing the same syntax to be portable to HTML, CSS, and even JavaScript. Methods/Materials The Lima prototype was written in the Scala programming language, which includes a parser combinator library that was an integral part of the project. Additionally, it used a Java library called JTidy for cleaning up outputted HTML, the RSyntaxTextArea Java library for creating a live-updating GUI, and the ScalaJS compiler to create a web interface. The syntax was based on LISP S-expressions, but it used Clojure-style vectors for tag properties. The final project is written in the Clojure programming language itself, without the use of any external libraries. The code is considerably better than the original, although it lacks JTidy integration, a GUI, and a web interface. I plan to add those features. Results The Scala version came out to around 400 lines of code. The parser was the slowest part, taking about 80 milliseconds to parse a 50-line document with complicated syntax. The HTML generator was faster, taking about 18 milliseconds to generate the HTML for that same document. The Clojure version is much shorter and much faster: at around 130 lines of code, it parses and generates the same document in less than 10 milliseconds (usually closer to 5) and has many features that the original lacked. Lima#s syntax is fairly simple, but it can be very powerful. Conclusions/Discussion Lima tends to be at least as readable as HTML, but requires much less typing. The compiler is fast, even for larger projects, and the syntax error messages are informative. It generates HTML5-compliant output, provided the user doesn#t make use of any deprecated tags. Anything that can be written with HTML can also be written with Lima, and conveniences like macros and inline Clojure evaluation make creating web pages easier than before. I think that Lima is useful to web developers seeking refuge from the verbosity of HTML. JavaScript (through ClojureScript) and CSS

Summary statement

An alternative syntax for HTML, focused on usability, extensibility, and consistency.

Competition history

  • CSEF 2014 Mathematics & Software · Entry S1410

Resources

Related projects

Closest projects by meaning, across every fair and year in the corpus.

Browse more like this

Source: California Science & Engineering Fair public projects

Save projects to your library

Sign in with Google to keep track of projects you find interesting, organized into folders. An account also raises your daily allowance for “Has this been done?”, and lets you create a key for the MCP server with a much higher limit than anonymous use. Browsing stays public.

Continue with Google