plhtml

所属分类:编程语言基础
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2020-08-21 13:28:22
上 传 者sh-1993
说明:  编程语言HTML的解释器
(Interpreter for the programming language HTML)

文件列表:
.idea/ (0, 2020-08-21)
.idea/codeStyles/ (0, 2020-08-21)
.idea/codeStyles/Project.xml (510, 2020-08-21)
.idea/codeStyles/codeStyleConfig.xml (142, 2020-08-21)
.idea/inspectionProfiles/ (0, 2020-08-21)
.idea/inspectionProfiles/Project_Default.xml (267, 2020-08-21)
.idea/misc.xml (174, 2020-08-21)
.idea/modules.xml (264, 2020-08-21)
.idea/plhtml.iml (281, 2020-08-21)
.idea/scopes/ (0, 2020-08-21)
.idea/scopes/Exclude_Tests.xml (124, 2020-08-21)
.idea/vcs.xml (180, 2020-08-21)
NOTES.md (1117, 2020-08-21)
ast/ (0, 2020-08-21)
ast/ast.go (2012, 2020-08-21)
ast/binaryOpExpr.go (677, 2020-08-21)
ast/boolConst.go (515, 2020-08-21)
ast/controlFlowStmt.go (719, 2020-08-21)
ast/identifier.go (536, 2020-08-21)
ast/intConst.go (507, 2020-08-21)
ast/mainFunc.go (529, 2020-08-21)
ast/program.go (477, 2020-08-21)
ast/programBody.go (455, 2020-08-21)
ast/readStmt.go (520, 2020-08-21)
ast/realConst.go (518, 2020-08-21)
ast/stringConst.go (539, 2020-08-21)
ast/unaryExpr.go (580, 2020-08-21)
ast/varAssign.go (577, 2020-08-21)
ast/varDecl.go (560, 2020-08-21)
ast/writeStmt.go (463, 2020-08-21)
grammar.txt (1315, 2020-08-21)
interpreter/ (0, 2020-08-21)
interpreter/interpreter.go (12401, 2020-08-21)
logger/ (0, 2020-08-21)
logger/myLogger.go (2451, 2020-08-21)
main.go (867, 2020-08-21)
main_test.go (1961, 2020-08-21)
... ...

Finally people that "program" in HTML and call themselves "programmers" can be programmers for real. All code written in programming language HTML (PL/HTML for short) is syntactically valid HTML code (validated using [W3C validator][1]), which was one of the main goals during language design. Also names of all statements were handpicked from the list of HTML elements in such a way that name or description of an element describes the meaning of the statement (`var`, `input`, `output`, etc). [1]: https://validator.w3.org/#validate-by-input Following program displays first `n` Fibonacci numbers. ```html `Fibonacci numbers`
a b c i n a b i `n: `
a + ` ` c a b i
``` Other examples can be found in the *tests/* folder. # Specification * Keywords: `doctype`, `lang`, `html`, `head`, `title`,`body`, `main`, `var`, `class`, `output`, `input`, `name`, `data`, `value`, `div`, `if`, `while` * Builtin types: `integer`, `real`, `boolean`, `string` * Arithmetical operators: `+`, `-`, `*`, `/`, `%`, `(`, `)` * Logical operators: `∧`, `∨`, `!` * Comparison operators: `<`, `>`, `≤`, `≥`, `=`, `≠` * Special characters: `\\`, `\t`, `\n` # How to Use 1. Install [Go compiler](https://golang.org/dl/). 2. Build executable with `go build`. 3. Run interpreter through command line. ```bat plhtml [] ``` # References Useful reading materials: - [CS143 Compilers](https://web.stanford.edu/class/archive/cs/cs143/cs143.1128/) - [Implementing Lexers and Parsers](http://www.cse.chalmers.se/edu/year/2015/course/DAT150/lectures/proglang-04.html) - [A Simple Recursive Descent Parser](http://math.hws.edu/javanotes/c9/s5.html) - [Let’s Build A Simple Interpreter](https://ruslanspivak.com/lsbasi-part1/) Source code of compilers for some programming languages: - [Go](https://github.com/golang/go/blob/master/src/go) - [TypeScript](https://github.com/microsoft/TypeScript/tree/master/src/compiler)

近期下载者

相关文件


收藏者