Ed Davis

Joined 31 August 2022
no edit summary
No edit summary
No edit summary
Line 3:
----------------
 
From Wikipedia: ([https://en.wikipedia.org/wiki/Lexical_analysis) Wikipedia]
 
Lexical analysis is the process of converting a sequence of characters (such as in a
Line 15:
 
;Specification
 
{| class="wikitable"
|-
! Characters !! Regular expression !! Name
|-
| integers || [0-9]+ || Integer
|-
| char literal || 'x' || Integer
|-
| identifiers || [_a-zA-Z][_a-zA-Z0-9]+ || Ident
|-
| string literal || ".*" || String
|}
 
 
Notes: For char literals, '\n' is supported as a new line
character. To represent \, use: '\\'. \n may also be used in
Strings, to print a newline. No other special sequences are
supported.
 
operators:
Line 80 ⟶ 61:
| ',' || comma || Comma
|}
 
{| class="wikitable"
|-
! Characters !! Regular expression !! Name
|-
| integers || [0-9]+ || Integer
|-
| char literal || 'x' || Integer
|-
| identifiers || [_a-zA-Z][_a-zA-Z0-9]+ || Ident
|-
| string literal || ".*" || String
|}
 
 
Notes: For char literals, '\n' is supported as a new line
character. To represent \, use: '\\'. \n may also be used in
Strings, to print a newline. No other special sequences are
supported.
 
 
keywords:
Line 122 ⟶ 123:
------
 
{| class="wikitable"
line 4 col 1 Print
|-
line 4 col 6 Lparen
! Line !! Number !! Column !! Number !! Token name !! other data
line 4 col 7 String "Hello, World!\n"
|-
line 4 col 24 Rparen
| line || 4 || col || 1 Print 25 Semi||
| line || 54 || col || 6 1Lparen EOI||
| line || 4 || col || 7 String || "Hello, World!\n"
| line || 4 || col || 24 6Rparen Lparen||
| line || 4 || col || 25 Semi 24 Rparen||
| line || 45 || col || 1 PrintEOI ||
|}
 
<lang c>
155

edits